diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 14c2f3a11..efbb4ffab 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -296,7 +296,12 @@ class ForumsController < ApplicationController #检查forum的名字 def check_forum_name - forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false + forum_name_exist = true + if params[:forum_id] + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false + else + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false + end render :text => forum_name_exist end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 90a0f3ed6..2d7bf02b1 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -75,7 +75,7 @@ class StudentWorkController < ApplicationController @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @homework_commons = @course.homework_commons.order("created_at desc") @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 + @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 @show_all = false course_group = CourseGroup.find_by_id(@group) if @group @@ -86,7 +86,7 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -106,7 +106,7 @@ class StudentWorkController < ApplicationController @stundet_works = [] end else - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 35860c728..9a6f72e2e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -130,7 +130,7 @@ class UsersController < ApplicationController when 'apply' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc") when 'homework' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc") when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") # when 'forge_message' diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index f26f5c19b..f73cc87e6 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -75,7 +75,7 @@ module ApiHelper # 学生获取课程作业的状态 def get_homework_status homework homework_status = "" - if !homework.nil? + if homework if homework.homework_type == 1 && homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cfb655baa..41e016562 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2299,7 +2299,7 @@ module ApplicationHelper def homework_anonymous_comment homework if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" - elsif homework.student_works.count >= 2 #作业份数大于2 + elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 case homework.homework_detail_manual.comment_status when 1 link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' @@ -2309,7 +2309,7 @@ module ApplicationHelper # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end else - link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评" + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评" end link end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index b1020d938..f6b083b4d 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -464,7 +464,7 @@ module UsersHelper no_html = "message" arr = details_to_strings(journal.details, no_html) unless journal.notes.blank? - arr << "留言内容:" + journal.notes + arr << journal.notes end str = '' arr.each { |item| str = str+item } @@ -582,7 +582,7 @@ module UsersHelper option << "请选择发布作业的课程" option << -1 type << option - user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] option << course.name+"("+course.time.to_s+course.term+")" option << course.id diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 47ab30cb1..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,7 +73,7 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location,:act_as_course_activity,:act_as_forge_activity + before_save :files_to_final_location,:act_as_course_activity after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score diff --git a/app/models/journal_reply.rb b/app/models/journal_reply.rb index a1ea761af..16055608a 100644 --- a/app/models/journal_reply.rb +++ b/app/models/journal_reply.rb @@ -16,7 +16,7 @@ class JournalReply < ActiveRecord::Base replier = User.find(self.reply_id) receivers = [] # 被回复的人发送消息 - if journal.user_id != self.reply_id && self.reply_id != journal.issue.author_id + if journal.user_id != self.reply_id && self.reply_id != journal.issue.author_id && self.reply_id != journal.issue.assigned_to_id receivers << replier end if journal.user_id != journal.issue.author_id && self.reply_id != journal.issue.author_id diff --git a/app/views/attachments/file.html.erb b/app/views/attachments/file.html.erb index 75fa1858c..0ce174545 100644 --- a/app/views/attachments/file.html.erb +++ b/app/views/attachments/file.html.erb @@ -1,26 +1,38 @@ -

<%=h @attachment.filename %>

+
+
+
+
+
+

<%=h @attachment.filename %>

-
-

<%= h("#{@attachment.description} - ") unless @attachment.description.blank? %> - <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

-

<%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> - (<%= number_to_human_size @attachment.filesize %>)    - - <% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') && - User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> - <%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review', - :action => 'assign', :action_type => 'attachment', - :id=>@attachment.project, - :change_id => '', :attachment_id => @attachment.id, - }, :class => 'icon icon-add') %> - <% end %> -

-
-  -<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %> +
+

<%= h("#{@attachment.description} - ") unless @attachment.description.blank? %> + <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

+

<%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> + (<%= number_to_human_size @attachment.filesize %>)    + + <% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') && + User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %> + <%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review', + :action => 'assign', :action_type => 'attachment', + :id=>@attachment.project, + :change_id => '', :attachment_id => @attachment.id, + }, :class => 'icon icon-add') %> + <% end %> +

+
+   + <%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %> + + <% html_title @attachment.filename %> -<% html_title @attachment.filename %> + <% content_for :header_tags do -%> + <%= stylesheet_link_tag "scm" -%> + <% end -%> +
+
+
+
+
+
-<% content_for :header_tags do -%> - <%= stylesheet_link_tag "scm" -%> -<% end -%> diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 03c5c0ac4..f5e22002a 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -3,7 +3,7 @@ <% if tag_name && tag_name == k%> <%= k%>×<%= v%> <% else%> - <%= k%>×<%= v%> + <%= k%>×<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/forums/_file_form.html.erb b/app/views/forums/_file_form.html.erb index 030c8ff0e..560afc6d9 100644 --- a/app/views/forums/_file_form.html.erb +++ b/app/views/forums/_file_form.html.erb @@ -47,7 +47,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %> - 上传附件 + 上传附件 <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb index 9c0ec27bd..ade5a24c4 100644 --- a/app/views/forums/_form_edit_mode.html.erb +++ b/app/views/forums/_form_edit_mode.html.erb @@ -9,10 +9,10 @@
- +
- +
确定
diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index fbbe023a0..286219356 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -10,7 +10,7 @@ <%= link_to forum.name, forum_path(forum),:class=>"f16 linkBlue" %>
-
<%= textAreailizable forum.description%>
+
<%= textAreailizable forum.description%>
创建者:<%= forum.creator.name %>
创建时间:<%= format_date(forum.created_at) %>
diff --git a/app/views/forums/_forum_tag_list.html.erb b/app/views/forums/_forum_tag_list.html.erb index 2a0257d63..b074cbca3 100644 --- a/app/views/forums/_forum_tag_list.html.erb +++ b/app/views/forums/_forum_tag_list.html.erb @@ -1,6 +1,6 @@ <% forum.tag_list.each do |tag|%> - <%= tag %> + <%= tag %> <%if forum.creator.id == User.current.id%> × <% end %> diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index ef1fbc12b..1fcbc6cab 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -1,23 +1,7 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %> \ No newline at end of file diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 8f5cb15cc..c31790f30 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -49,7 +49,7 @@ $("#reorder_popu").removeClass("sortArrowActiveD"); add_class("reorder_time"); }); - document.getElementById('forum_name').onkeydown = function() + $('#forum_name').keypress( function(e) { var n = 0; var str = this.value; @@ -61,9 +61,16 @@ n += 1;//英文,不多说了 } } - if(n >= 160 && event.keyCode != 8) - event.returnValue = false; - } + if(n >= 160 && e.keyCode != 8) + if(document.all) + { + e.returnValue = false; + } + else + { + e.preventDefault(); + } + }) }); function check_and_submit(doc){ $("#error").html('').hide(); @@ -89,7 +96,7 @@ if( name != ""){ $.get( '<%= check_forum_name_forums_path %>', - {"forum_name":name}, + {"forum_name":encodeURIComponent(name)}, function(data){ if( data == 'true'){ @@ -129,14 +136,14 @@ <%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
- +
- +
- + @@ -143,7 +149,7 @@
- +
<%= @forum.name%>
@@ -172,7 +178,8 @@ 编辑贴吧 - 删除贴吧 + 删除贴吧 + <% end %> diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 0efa57ccc..310cdb6ad 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,11 +1,16 @@ <%= javascript_include_tag 'new_user'%>
- + \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 4cafce30d..133a90547 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -56,7 +56,7 @@ <%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
-
+
<%= @memo.content.html_safe%>
@@ -75,7 +75,9 @@
回复(<%=@reply_count %>)
+ <% if @reply_count > 2%> 点击展开更多回复 + <% end %>
diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 5a29c113c..f6ada82eb 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -20,8 +20,9 @@ $('#tags_name2').val(""); $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); <%else%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); - $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', - :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").replaceWith('<%= escape_javascript(render :partial => 'tags/tag_new', :locals => {:obj => @obj, :object_flag => "6"}) %>'); +//render :partial => 'tags/course_attachment_tag_name', +//:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) <%end%> $("#tags_name_<%=@obj.id%>").val(""); diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 89800b768..f7017deab 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,12 +14,15 @@ - <% if homework_common.homework_detail_manual.comment_status == 1%> + + <% if homework_common.homework_detail_manual%> + <% if homework_common.homework_detail_manual.comment_status == 1%> 未开启匿评 - <% elsif homework_common.homework_detail_manual.comment_status == 2%> + <% elsif homework_common.homework_detail_manual.comment_status == 2%> 匿评中 - <% elsif homework_common.homework_detail_manual.comment_status == 3%> + <% elsif homework_common.homework_detail_manual.comment_status == 3%> 匿评已结束 + <% end%> <% end%>
diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index a8401c406..f5287cbd4 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -1,94 +1,70 @@ - + function searchByChange() + { + $("#search_by_input").val($("#search_by").val()); + } + -
- <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - - - - - - - - - -
- <%= l(:label_software_user ) %> - - <%= l(:label_user_location) %> : - - - - - - - - - - -
- <%=link_to l(:field_homepage), home_path %> > - <%= l(:label_software_user)%> -
-
-<% end %> - - -
- <% if @users.size > 0 %> - <%= render :partial => 'user_show' %> +
+ <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> + + + + + + + + + + +
+ <%= l(:label_software_user ) %> + + <%= l(:label_user_location) %> : + + +
+ <%=link_to l(:field_homepage), home_path %> > + <%= l(:label_software_user)%> +
+
+ <% end %> - - <% else %> - <%= render :partial => "layouts/no_content"%> - <% end %> -
- +
+
+
-<% html_title(l(:label_user_plural)) -%> diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 550089627..149cd8857 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -127,18 +127,7 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -397,25 +397,26 @@ <% end %> <% if ma.course_message_type == "JournalsForMessage" %> <% if ma.course_message.jour_type == 'Course' %> - - + <% if params[:type] != 'homework' %> + + <% end %> <% else %>