diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 965aacab0..f71103973 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -101,27 +101,27 @@ class MessagesController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE end - # 与我相关动态的记录add start - if(@board && @board.course) #项目的先不管 - teachers = searchTeacherAndAssistant(@board.course) - for teacher in teachers - if(teacher.user_id != User.current.id) - notify = ActivityNotify.new() - if(@board.course) - notify.activity_container_id = @board.course_id - notify.activity_container_type = 'Course' - else - notify.activity_container_id = @board.project_id - notify.activity_container_type = 'Project' - end - notify.activity_id = @message.id - notify.activity_type = 'Message' - notify.notify_to = teacher.user_id - notify.is_read = 0 - notify.save() - end - end - end + # # 与我相关动态的记录add start + # if(@board && @board.course) #项目的先不管 + # teachers = searchTeacherAndAssistant(@board.course) + # for teacher in teachers + # if(teacher.user_id != User.current.id) + # notify = ActivityNotify.new() + # if(@board.course) + # notify.activity_container_id = @board.course_id + # notify.activity_container_type = 'Course' + # else + # notify.activity_container_id = @board.project_id + # notify.activity_container_type = 'Project' + # end + # notify.activity_id = @message.id + # notify.activity_type = 'Message' + # notify.notify_to = teacher.user_id + # notify.is_read = 0 + # notify.save() + # end + # end + # end # 与我相关动态的记录add end call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index ea4dd404a..9f8d25c7e 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -12,10 +12,37 @@ class StudentWorkController < ApplicationController ### def program_test - resultObj = {status: 0, results: [], error_msg: '', time: Time.now} - student_work = find_or_save_student_work - unless student_work - resultObj[:status] = 100 + is_test = params[:is_test] == 'true' + resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')} + unless is_test + student_work = find_or_save_student_work + + unless student_work + resultObj[:status] = 100 + else + if @homework.homework_type == 2 && @homework.homework_detail_programing + result = test_realtime(student_work, params[:src]) + logger.debug result + resultObj[:status] = result["status"] + resultObj[:results] = result["results"] + resultObj[:error_msg] = result["error_msg"] + results = result["results"] + if result["status"].to_i == -2 #编译错误 + results = [result["error_msg"]] + end + student_work_test = student_work.student_work_tests.build(status: result["status"], results: results, + src: params[:src]) + unless student_work.save + resultObj[:status] = 200 + else + resultObj[:status] = result["status"].to_i + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count + end + + end + end + else if @homework.homework_type == 2 && @homework.homework_detail_programing result = test_realtime(student_work, params[:src]) @@ -27,18 +54,15 @@ class StudentWorkController < ApplicationController if result["status"].to_i == -2 #编译错误 results = [result["error_msg"]] end - student_work_test = student_work.student_work_tests.build(status: result["status"], results: results, - src: params[:src]) - unless student_work.save - resultObj[:status] = 200 - else - resultObj[:status] = result["status"].to_i - resultObj[:time] = student_work_test.created_at.to_s(:db) - resultObj[:index] = student_work.student_work_tests.count - end - + + resultObj[:status] = result["status"].to_i + resultObj[:time] = Time.now.strftime('%Y-%m-%d %T') + resultObj[:index] = 0 end + end + + render :json => resultObj end @@ -142,10 +166,18 @@ class StudentWorkController < ApplicationController end def new + if @homework.homework_type==2 + redirect_to new_user_commit_homework_users_path(homework_id: @homework.id) + return + end + @user = User.current @student_work = @homework.student_works.where("user_id = ?",User.current.id).first if @student_work.nil? @student_work = StudentWork.new end + respond_to do |format| + format.html{ render :layout => "new_base_user"} + end end def create @@ -186,11 +218,12 @@ class StudentWorkController < ApplicationController end def edit + @user = User.current if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 render_403 else respond_to do |format| - format.html + format.html{ render :layout => "new_base_user"} end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5bd124fb9..e3480b238 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -106,18 +106,18 @@ class UsersController < ApplicationController return end # 当前用户查看消息,则设置消息为已读 - if params[:viewed] == "all" - course_querys = @user.course_messages - forge_querys = @user.forge_messages - user_querys = @user.user_feedback_messages - forum_querys = @user.memo_messages - if User.current.id == @user.id - course_querys.update_all(:viewed => true) - forge_querys.update_all(:viewed => true) - user_querys.update_all(:viewed => true) - forum_querys.update_all(:viewed => true) - end - end + #if params[:viewed] == "all" + # course_querys = @user.course_messages + # forge_querys = @user.forge_messages + # user_querys = @user.user_feedback_messages + # forum_querys = @user.memo_messages + # if User.current.id == @user.id + # course_querys.update_all(:viewed => true) + # forge_querys.update_all(:viewed => true) + # user_querys.update_all(:viewed => true) + # forum_querys.update_all(:viewed => true) + # end + #end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] when nil @@ -347,6 +347,7 @@ class UsersController < ApplicationController def new_user_commit_homework @user = User.current @homework = HomeworkCommon.find(params[:homework_id]) + @is_test = params[:is_test] == 'true' @student_work = @homework.student_works.where(user_id: User.current.id).first if @student_work.nil? @student_work = StudentWork.new @@ -359,7 +360,7 @@ class UsersController < ApplicationController def user_commit_homework flash[:notice] = l(:notice_successful_create) - redirect_to user_homeworks_user_path(User.current) + redirect_to student_work_index_url(:homework => params[:homework]) end def user_new_homework diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ad9322cbc..2f210f466 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2347,7 +2347,7 @@ module ApplicationHelper if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 link_to "修改作品", "", :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "作品已交", "",:class => 'c_blue',:title => "编程作业不可修改作品" + link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品" else link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue' end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index f24d5078f..bff997ba4 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -1,4 +1,6 @@ # encoding: utf-8 +include UserScoreHelper + module StudentWorkHelper def user_projects_option cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb index 41f76a792..c94763e31 100644 --- a/app/helpers/user_score_helper.rb +++ b/app/helpers/user_score_helper.rb @@ -433,7 +433,7 @@ module UserScoreHelper #协同得分 def collaboration(option_number) - option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo + option_number.memo * 2 + option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo end #影响力得分 def influence(option_number) @@ -445,7 +445,7 @@ module UserScoreHelper end #项目贡献得分 def active(option_number) - option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4 + option_number.memo * 2 + option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4 end #更新发帖数 diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 4f62d24c2..eae880380 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -15,6 +15,8 @@ class CourseMessage < ActiveRecord::Base after_create :add_user_message def add_user_message - self.message_alls << MessageAll.new(:user_id => self.user_id) + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end end diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index 2d05972ab..0c8b3384f 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -22,6 +22,8 @@ class ForgeMessage < ActiveRecord::Base after_create :add_user_message def add_user_message - self.message_alls << MessageAll.new(:user_id => self.user_id) + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end end diff --git a/app/models/memo_message.rb b/app/models/memo_message.rb index 9be00ce14..ce3896389 100644 --- a/app/models/memo_message.rb +++ b/app/models/memo_message.rb @@ -12,6 +12,8 @@ class MemoMessage < ActiveRecord::Base after_create :add_user_message def add_user_message - self.message_alls << MessageAll.new(:user_id => self.user_id) + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end end diff --git a/app/models/news.rb b/app/models/news.rb index 6e2725d1c..a9e9d1d18 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -121,7 +121,7 @@ class News < ActiveRecord::Base # Description 公用表中也要记录 def act_as_forge_activity # 如果是project为空,那么是课程相关的,不需要保存 - if !self.project.nil? + if self.project self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.project.id) end diff --git a/app/models/query.rb b/app/models/query.rb index 19bd1bed5..7f51aa53c 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -492,26 +492,28 @@ class Query < ActiveRecord::Base def project_statement project_clauses = [] - if project && !project.descendants.active.empty? - ids = [project.id] - if has_filter?("subproject_id") - case operator_for("subproject_id") - when '=' - # include the selected subprojects - ids += values_for("subproject_id").each(&:to_i) - when '!*' - # main project only - else - # all subprojects + # unless project.descendants.blank? + if project && project.descendants && project.descendants.active && !project.descendants.active.empty? + ids = [project.id] + if has_filter?("subproject_id") + case operator_for("subproject_id") + when '=' + # include the selected subprojects + ids += values_for("subproject_id").each(&:to_i) + when '!*' + # main project only + else + # all subprojects + ids += project.descendants.collect(&:id) + end + elsif Setting.display_subprojects_issues? ids += project.descendants.collect(&:id) end - elsif Setting.display_subprojects_issues? - ids += project.descendants.collect(&:id) + project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',') + elsif project + project_clauses << "#{Project.table_name}.id = %d" % project.id end - project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',') - elsif project - project_clauses << "#{Project.table_name}.id = %d" % project.id - end + # end project_clauses.any? ? project_clauses.join(' AND ') : nil end diff --git a/app/models/user_feedback_message.rb b/app/models/user_feedback_message.rb index 02335b8e2..db7d3a384 100644 --- a/app/models/user_feedback_message.rb +++ b/app/models/user_feedback_message.rb @@ -11,6 +11,8 @@ class UserFeedbackMessage < ActiveRecord::Base after_save :add_user_message def add_user_message - self.message_alls << MessageAll.new(:user_id => self.user_id) + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end end diff --git a/app/views/attachments/_new_form.html.erb b/app/views/attachments/_new_form.html.erb index 38b471897..47f6fd202 100644 --- a/app/views/attachments/_new_form.html.erb +++ b/app/views/attachments/_new_form.html.erb @@ -23,6 +23,7 @@ <% end %> <% end %> +
<% project = project %> <%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn', :style => ie8? ? 'display:none' : '' %> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index c90dbf724..5ce51ff7b 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -10,6 +10,7 @@ div.respond-form .reply_btn{margin-left:565px;margin-top:5px;} div.recall_con{width:570px;} div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} + .ke-container{height: 80px !important;} <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %> -
-

创建作品

-
-
-
-
- <%= form_for(@student_work, - :html => { :multipart => true }, - :url => {:controller => 'student_work', - :action => 'create', - :homework => @homework.id - }) do |f|%> -
- <% if @homework.homework_type == 1%> -
- 提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息 -
+
+
+
提交作品
+
+
+
+
+ <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'student_work', + :action => 'create', + :homework => @homework.id + }) do |f|%> +
+ <% if @homework.homework_type == 1%> +
+ 提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息 +
+ <% end%> +

+ + <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> + <% if @homework.homework_type != 2%> + + 项目信息 + + + <% end%> +

+

+

+
+

+ + <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %> +

+
+

+ + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> + <% else %> + <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% end%> +

+

+

+
+ <% if @homework.homework_type != 2%> +

+ + <%= render :partial => 'attachments/new_form' %> +

+
+ <% end%> +

+ 提交作品 + <%= link_to "返  回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%> +

+

+
<% end%> -

- - <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> - <% if @homework.homework_type != 2%> - - 项目信息 - - - <% end%> -

-

-

-
-

- - <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %> -

-
-

- - <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> - <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> - <% else %> - <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> - <% end%> -

-

-

-
- <% if @homework.homework_type != 2%> -

- - <%= render :partial => 'attachments/new_form' %> -

-
- <% end%> -

- 提交作品 - <%= link_to "返  回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%> -

-

-
- <% end%> +
+
+
+
-
-
-
<% else %> @@ -125,8 +127,8 @@ -
-
+ +
提交作品
@@ -201,6 +203,5 @@ <% end %> <% end %>
-
<% end %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f29512b0e..07a2dad39 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -22,7 +22,7 @@
截止时间:<%= activity.end_time.to_s %>
- 作业描述:<%= activity.description.html_safe %> + <%= activity.description.html_safe %>
-
帖子描述: +
<% if activity.parent_id.nil? %> <%= activity.content.to_s.html_safe%> <% else %> @@ -85,7 +85,7 @@ <% activity= activity.parent ? activity.parent : activity%> <% replies_all_i = 0 %> <% if count > 0 %> -
+
    <% activity.children.reorder("created_on desc").each do |reply|%> <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index a558911c1..d2213c743 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -19,7 +19,6 @@ 发布时间:<%= format_time(activity.created_on) %>
- 通知描述: <%= activity.description.html_safe %>
@@ -57,7 +56,7 @@ <% replies_all_i = 0 %> <% if count > 0 %> -
+
    <% activity.comments.reorder("created_on desc").each do |comment| %> <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 436ae2f46..24adf108e 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -28,7 +28,7 @@
    发布时间:<%= format_time(activity.published_at) %>
    -
    问卷描述:<%=activity.polls_description.html_safe.to_s%>
    +
    <%=activity.polls_description.html_safe.to_s%>
-
缺陷描述: +
<% if activity.description? %> <%= textAreailizable activity, :description, :attachments => activity.attachments %> <% end %> @@ -94,7 +94,7 @@ <% replies_all_i = 0 %> <% if count > 0 %> -
+
    <% activity.journals.reorder("created_on desc").each do |reply| %> <% replies_all_i=replies_all_i + 1 %> diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 6c3842f73..5fc10e48c 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -26,7 +26,7 @@
    时间:<%= format_time(activity.created_on) %>
    -
    帖子描述: +
    <% if activity.parent_id.nil? %> <%= activity.content.to_s.html_safe%> <% else %> @@ -71,7 +71,7 @@ <% activity= activity.parent_id.nil? ? activity : activity.parent %> <% replies_all_i = 0 %> <% if count > 0 %> -
    +
      <% activity.children.reorder("created_on desc").each do |reply| %> <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index f1529ffb8..2d447d739 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -9,7 +9,7 @@ span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} .ke-inline-block{display: none;} - .ke-container{height: 40px !important;} + .ke-container{height: 30px !important;} <% user_activities.each do |user_activity| if user_activities %> diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 076383607..f0bab160f 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -19,6 +19,11 @@
      <%= user_for_homework_common homework_common,is_teacher %>
      + <% if homework_common.homework_type == 2 && is_teacher%> +
      + <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue' %> +
      + <% end %>
      <%= l(:label_end_time)%>:<%= homework_common.end_time%>
      diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index a150c39ba..8d5a1a48c 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -41,19 +41,17 @@
      -
      提交作品
      +
      <%= @is_test ? '模拟答题' : '提交作品' %>
      <%= @homework.name %>
      截止时间:<%= @homework.end_time %>
      <%= @homework.user.show_name %> -

      <%= @homework.description %>
      -输入 2 1 1 4 4 2 3 6 5
      -输出 15
      +

      <%= @homework.description.html_safe %>

      -

      注:迟交扣2分,缺评一个作品扣2

      +
      <%= form_for(@student_work, @@ -64,7 +62,7 @@ :homework => @homework.id }, :method => :post) do |f|%> - +
      请使用 <%= @homework.language_name %> 语言编写
      @@ -76,13 +74,18 @@
      测试代码 + <% unless @is_test %> 提交代码 + <% end %>
      <% end %>
      + +
      + <% @student_work.student_work_tests.each_with_index do |test, index| %>

      第<%= @student_work.student_work_tests.count - index%>次测试

      <%= test.created_at.to_s(:db) %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c1cd3723f..92f3f4a1a 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -37,4 +37,4 @@
    -<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %> +<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %> diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 29020560d..1d288b4b8 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -29,11 +29,7 @@
    -<% if params[:type].nil? %> -
    - 有 <%= User.current.count_new_message %> 封未读<%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> -
    -<% end %> + <% if @message_alls.count >0 %> <%# 课程消息 %> <% unless @message_alls.nil? %> @@ -59,7 +55,7 @@ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -
    +
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -100,7 +96,7 @@ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -
    + <% end %> @@ -182,7 +178,7 @@ :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -
    + <% end %> @@ -240,7 +236,7 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -
    + <% end %> @@ -264,7 +260,7 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> -
    +
  • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
  • @@ -290,7 +286,7 @@ function message_titile_show(obj,e) { obj.parent().next("div").show(); - obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","fixed"); + obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute"); } function message_titile_hide(obj) { diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 60e630959..19cdd845f 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -8,6 +8,7 @@ span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} + .ke-container{height: 80px !important;}
    diff --git a/db/migrate/20150829023459_forge_messages.rb b/db/migrate/20150829023459_forge_messages.rb index c468ad68f..96369a323 100644 --- a/db/migrate/20150829023459_forge_messages.rb +++ b/db/migrate/20150829023459_forge_messages.rb @@ -1,78 +1,78 @@ # encoding: UTF-8 class ForgeMessages < ActiveRecord::Migration def up - Project.all.each do |project| - transaction do - project.forge_messages << ForgeMessage.new(:user_id => project.user_id, :project_id => project.id) - - # 新闻 - project.news.each do |new| - new.project.members.each do |m| - if m.user_id != new.author_id - if m.created_on < new.created_on # 在成员加入项目之后 - new.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => new.project_id, :viewed => true) - end - end - end - end - - # 新闻回复 - project.news.each do |new| - if new.comments - new.comments.each do |comment| - if comment.author_id != comment.commented.author_id - comment.forge_messages << ForgeMessage.new(:user_id => comment.commented.author_id, :project_id => comment.commented.project.id, :viewed => true) - end - end - end - end - - # 讨论区 - if project.boards.first - project.boards.first.messages.each do |message| - if message.parent_id.nil? # 主贴 - message.project.members.each do |m| - if m.user_id != message.author_id - if m.created_on < message.created_on - message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true) - end - end - end - else # 回帖 - message.project.members.each do |m| - if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息 - if m.created_on < message.created_on - message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true) - end - end - end - end - end - end - - # 缺陷 - project.issues.each do |issue| - unless issue.author_id == issue.assigned_to_id - issue.forge_messages << ForgeMessage.new(:user_id => issue.assigned_to_id, :project_id => issue.project_id, :viewed => true) - end - end - - # 缺陷更新 - project.issues.each do |issue| - if issue.journals - issue.journals.each do |journal| - if journal.user_id != journal.issue.author_id - journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.author_id, :project_id => journal.issue.project_id, :viewed => true) - end - if journal.user_id != journal.issue.assigned_to_id && journal.issue.assigned_to_id != journal.issue.author_id # 指派人不是自己的话,则给指派人发送 - journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.assigned_to_id, :project_id => journal.issue.project_id, :viewed => true) - end - end - end - end - - end - end + # Project.all.each do |project| + # transaction do + # project.forge_messages << ForgeMessage.new(:user_id => project.user_id, :project_id => project.id) + # + # # 新闻 + # project.news.each do |new| + # new.project.members.each do |m| + # if m.user_id != new.author_id + # if m.created_on < new.created_on # 在成员加入项目之后 + # new.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => new.project_id, :viewed => true) + # end + # end + # end + # end + # + # # 新闻回复 + # project.news.each do |new| + # if new.comments + # new.comments.each do |comment| + # if comment.author_id != comment.commented.author_id + # comment.forge_messages << ForgeMessage.new(:user_id => comment.commented.author_id, :project_id => comment.commented.project.id, :viewed => true) + # end + # end + # end + # end + # + # # 讨论区 + # if project.boards.first + # project.boards.first.messages.each do |message| + # if message.parent_id.nil? # 主贴 + # message.project.members.each do |m| + # if m.user_id != message.author_id + # if m.created_on < message.created_on + # message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true) + # end + # end + # end + # else # 回帖 + # message.project.members.each do |m| + # if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息 + # if m.created_on < message.created_on + # message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true) + # end + # end + # end + # end + # end + # end + # + # # 缺陷 + # project.issues.each do |issue| + # unless issue.author_id == issue.assigned_to_id + # issue.forge_messages << ForgeMessage.new(:user_id => issue.assigned_to_id, :project_id => issue.project_id, :viewed => true) + # end + # end + # + # # 缺陷更新 + # project.issues.each do |issue| + # if issue.journals + # issue.journals.each do |journal| + # if journal.user_id != journal.issue.author_id + # journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.author_id, :project_id => journal.issue.project_id, :viewed => true) + # end + # if journal.user_id != journal.issue.assigned_to_id && journal.issue.assigned_to_id != journal.issue.author_id # 指派人不是自己的话,则给指派人发送 + # journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.assigned_to_id, :project_id => journal.issue.project_id, :viewed => true) + # end + # end + # end + # end + # + # end + # end end def down diff --git a/db/migrate/20150829024549_course_messages.rb b/db/migrate/20150829024549_course_messages.rb index 34f4e9ef2..9d66bf9cd 100644 --- a/db/migrate/20150829024549_course_messages.rb +++ b/db/migrate/20150829024549_course_messages.rb @@ -1,80 +1,80 @@ # encoding: UTF-8 class CourseMessages < ActiveRecord::Migration def up - Course.all.each do |course| - transaction do - put course.id - course.course_messages << CourseMessage.new(:user_id => course.tea_id,:course_id => course.id) - # 作业 - course.homework_commons.each do |homework_common| - homework_common.course.members.each do |m| - if m.user_id != homework_common.user_id - if m.created_on < homework_common.created_at - homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) - end - end - end - end - - # 通知 - course.news.each do |new| - new.course.members.each do |m| - if m.user_id != new.author_id - if m.created_on < new.created_on # 在成员加入课程之后 - new.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) - end - end - end - end - - # 通知的回复 - course.news.each do |new| - if new.comments - new.comments.each do |comment| - if comment.author_id != comment.commented.author_id - comment.course_messages << CourseMessage.new(:user_id => comment.commented.author_id, :course_id => course.id, :viewed => true) - end - end - end - end - - # 讨论区 - if course.boards.first - course.boards.first.messages.each do |message| - if message.parent_id.nil? # 主贴 - message.course.members.each do |m| - if message.author.allowed_to?(:as_teacher, message.course) && m.user_id != message.author_id # 老师 自己的帖子不给自己发送消息 - if m.created_on < message.created_on - message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) - end - end - end - else # 回帖 - message.course.members.each do |m| - if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息 - if m.created_on < message.created_on - message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) - end - end - end - end - end - end - - # 问卷 - Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll| - if poll.polls_status == 2 #问卷是发布状态 - Course.find(poll.polls_group_id).members.each do |m| - if m.user_id != poll.user_id - if m.created_on < poll.created_at - poll.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) - end - end - end - elsif poll.polls_status == 1 #问卷是新建状态 - poll.course_messages.destroy_all - end - end + # Course.all.each do |course| + # transaction do + # put course.id + # course.course_messages << CourseMessage.new(:user_id => course.tea_id,:course_id => course.id) + # # 作业 + # course.homework_commons.each do |homework_common| + # homework_common.course.members.each do |m| + # if m.user_id != homework_common.user_id + # if m.created_on < homework_common.created_at + # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # end + # + # # 通知 + # course.news.each do |new| + # new.course.members.each do |m| + # if m.user_id != new.author_id + # if m.created_on < new.created_on # 在成员加入课程之后 + # new.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # end + # + # # 通知的回复 + # course.news.each do |new| + # if new.comments + # new.comments.each do |comment| + # if comment.author_id != comment.commented.author_id + # comment.course_messages << CourseMessage.new(:user_id => comment.commented.author_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # end + # + # # 讨论区 + # if course.boards.first + # course.boards.first.messages.each do |message| + # if message.parent_id.nil? # 主贴 + # message.course.members.each do |m| + # if message.author.allowed_to?(:as_teacher, message.course) && m.user_id != message.author_id # 老师 自己的帖子不给自己发送消息 + # if m.created_on < message.created_on + # message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # else # 回帖 + # message.course.members.each do |m| + # if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息 + # if m.created_on < message.created_on + # message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # end + # end + # end + # + # # 问卷 + # Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll| + # if poll.polls_status == 2 #问卷是发布状态 + # Course.find(poll.polls_group_id).members.each do |m| + # if m.user_id != poll.user_id + # if m.created_on < poll.created_at + # poll.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true) + # end + # end + # end + # elsif poll.polls_status == 1 #问卷是新建状态 + # poll.course_messages.destroy_all + # end + # end # 作品评阅 # course.homework_commons.each do |homework_common| @@ -107,8 +107,8 @@ class CourseMessages < ActiveRecord::Migration # end # 作品讨论 - end - end + # end + # end end def down diff --git a/db/migrate/20150829081822_update_message_time.rb b/db/migrate/20150829081822_update_message_time.rb index 09e42b6d1..a5b2457ad 100644 --- a/db/migrate/20150829081822_update_message_time.rb +++ b/db/migrate/20150829081822_update_message_time.rb @@ -1,25 +1,25 @@ class UpdateMessageTime < ActiveRecord::Migration def up - course_count = CourseMessage.all.count / 30 + 1 - transaction do - for i in 1 ... course_count do i - CourseMessage.page(i).per(30).each do |cmessage| - if cmessage.course_message - if cmessage.course_message.respond_to?("created_at") - cmessage.created_at = cmessage.course_message.created_at - elsif cmessage.course_message.respond_to?("created_on") - cmessage.created_at = cmessage.course_message.created_on - end - cmessage.save - puts cmessage.id - - course_all_message = MessageAll.where("message_type = '#{cmessage.class.to_s}' and message_id = '#{cmessage.id}'").first - course_all_message.created_at = cmessage.created_at - course_all_message.save - end - end - end - end + # course_count = CourseMessage.all.count / 30 + 1 + # transaction do + # for i in 1 ... course_count do i + # CourseMessage.page(i).per(30).each do |cmessage| + # if cmessage.course_message + # if cmessage.course_message.respond_to?("created_at") + # cmessage.created_at = cmessage.course_message.created_at + # elsif cmessage.course_message.respond_to?("created_on") + # cmessage.created_at = cmessage.course_message.created_on + # end + # cmessage.save + # puts cmessage.id + # + # course_all_message = MessageAll.where("message_type = '#{cmessage.class.to_s}' and message_id = '#{cmessage.id}'").first + # course_all_message.created_at = cmessage.created_at + # course_all_message.save + # end + # end + # end + # end end def down diff --git a/db/migrate/20150829130302_update_forge_message_time.rb b/db/migrate/20150829130302_update_forge_message_time.rb index 295cafea6..3121278ae 100644 --- a/db/migrate/20150829130302_update_forge_message_time.rb +++ b/db/migrate/20150829130302_update_forge_message_time.rb @@ -1,25 +1,25 @@ class UpdateForgeMessageTime < ActiveRecord::Migration def up - forge_count = ForgeMessage.all.count / 30 + 1 - transaction do - for i in 1 ... forge_count do i - ForgeMessage.page(i).per(30).each do |fmessage| - if fmessage.forge_message - if fmessage.forge_message.respond_to?("created_at") - fmessage.created_at = fmessage.forge_message.created_at - elsif fmessage.forge_message.respond_to?("created_on") - fmessage.created_at = fmessage.forge_message.created_on - end - fmessage.save - puts fmessage.id - - forge_all_message = MessageAll.where("message_type = '#{fmessage.class.to_s}' and message_id = '#{fmessage.id}'").first - forge_all_message.created_at = fmessage.created_at - forge_all_message.save - end - end - end - end + # forge_count = ForgeMessage.all.count / 30 + 1 + # transaction do + # for i in 1 ... forge_count do i + # ForgeMessage.page(i).per(30).each do |fmessage| + # if fmessage.forge_message + # if fmessage.forge_message.respond_to?("created_at") + # fmessage.created_at = fmessage.forge_message.created_at + # elsif fmessage.forge_message.respond_to?("created_on") + # fmessage.created_at = fmessage.forge_message.created_on + # end + # fmessage.save + # puts fmessage.id + # + # forge_all_message = MessageAll.where("message_type = '#{fmessage.class.to_s}' and message_id = '#{fmessage.id}'").first + # forge_all_message.created_at = fmessage.created_at + # forge_all_message.save + # end + # end + # end + # end end def down diff --git a/db/migrate/20150831070611_about_memo_message.rb b/db/migrate/20150831070611_about_memo_message.rb index fde94d2f9..a6e4a34c1 100644 --- a/db/migrate/20150831070611_about_memo_message.rb +++ b/db/migrate/20150831070611_about_memo_message.rb @@ -1,34 +1,34 @@ class AboutMemoMessage < ActiveRecord::Migration def up - Memo.all.each do |memo| - transaction do - # 贴吧帖子 - receivers = [] - u = User.find(6) - receivers << u - # 主贴 - if memo.parent_id.nil? - if memo.author_id != memo.forum.creator_id # 发帖人不是吧主 - receivers << memo.forum.creator - end - else # 回帖 - # 添加吧主 - if memo.author_id != memo.forum.creator_id - receivers << memo.forum.creator - end - # 添加发帖人 - unless memo.parent.nil? - if memo.author_id != memo.parent.author_id - receivers << memo.parent.author - puts memo.id - end - end - end - receivers.each do |r| - memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true) - end - end - end + # Memo.all.each do |memo| + # transaction do + # # 贴吧帖子 + # receivers = [] + # u = User.find(6) + # receivers << u + # # 主贴 + # if memo.parent_id.nil? + # if memo.author_id != memo.forum.creator_id # 发帖人不是吧主 + # receivers << memo.forum.creator + # end + # else # 回帖 + # # 添加吧主 + # if memo.author_id != memo.forum.creator_id + # receivers << memo.forum.creator + # end + # # 添加发帖人 + # unless memo.parent.nil? + # if memo.author_id != memo.parent.author_id + # receivers << memo.parent.author + # puts memo.id + # end + # end + # end + # receivers.each do |r| + # memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true) + # end + # end + # end end def down diff --git a/db/migrate/20150831093918_about_user_feedback_message.rb b/db/migrate/20150831093918_about_user_feedback_message.rb index d021bc3ad..a76b7c5e3 100644 --- a/db/migrate/20150831093918_about_user_feedback_message.rb +++ b/db/migrate/20150831093918_about_user_feedback_message.rb @@ -1,34 +1,34 @@ class AboutUserFeedbackMessage < ActiveRecord::Migration def up - JournalsForMessage.all.each do |jour_for_message| - transaction do - # 主留言 - if jour_for_message.jour_type == 'Principal' - receivers = [] - if jour_for_message.reply_id == 0 - if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息 - receivers << jour_for_message.jour - end - else # 留言回复 - reply_to = User.find(jour_for_message.reply_id) - if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人 - receivers << reply_to - end - unless jour_for_message.parent.nil? - if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 - receivers << jour_for_message.parent.jour - end - end - end - unless receivers.blank? - receivers.each do |r| - puts jour_for_message.id - jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true) - end - end - end - end - end + # JournalsForMessage.all.each do |jour_for_message| + # transaction do + # # 主留言 + # if jour_for_message.jour_type == 'Principal' + # receivers = [] + # if jour_for_message.reply_id == 0 + # if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息 + # receivers << jour_for_message.jour + # end + # else # 留言回复 + # reply_to = User.find(jour_for_message.reply_id) + # if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人 + # receivers << reply_to + # end + # unless jour_for_message.parent.nil? + # if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 + # receivers << jour_for_message.parent.jour + # end + # end + # end + # unless receivers.blank? + # receivers.each do |r| + # puts jour_for_message.id + # jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true) + # end + # end + # end + # end + # end end def down diff --git a/db/migrate/20150901004812_update_memo_message_time.rb b/db/migrate/20150901004812_update_memo_message_time.rb index 80ae557fc..8760a50a4 100644 --- a/db/migrate/20150901004812_update_memo_message_time.rb +++ b/db/migrate/20150901004812_update_memo_message_time.rb @@ -1,25 +1,25 @@ class UpdateMemoMessageTime < ActiveRecord::Migration def up - memo_count = Memo.all.count / 30 + 1 - transaction do - for i in 1 ... memo_count do i - MemoMessage.page(i).per(30).each do |memo_message| - if memo_message.memo - if memo_message.memo.respond_to?("created_at") - memo_message.created_at = memo_message.memo.created_at - elsif memo_message.memo.respond_to?("created_on") - memo_message.created_at = memo_message.memo.created_on - end - memo_message.save - puts memo_message.id - - memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first - memo_messages.created_at = memo_message.created_at - memo_messages.save - end - end - end - end + # memo_count = Memo.all.count / 30 + 1 + # transaction do + # for i in 1 ... memo_count do i + # MemoMessage.page(i).per(30).each do |memo_message| + # if memo_message.memo + # if memo_message.memo.respond_to?("created_at") + # memo_message.created_at = memo_message.memo.created_at + # elsif memo_message.memo.respond_to?("created_on") + # memo_message.created_at = memo_message.memo.created_on + # end + # memo_message.save + # puts memo_message.id + # + # memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first + # memo_messages.created_at = memo_message.created_at + # memo_messages.save + # end + # end + # end + # end end def down diff --git a/db/migrate/20150901004910_update_userfeeback_message_time.rb b/db/migrate/20150901004910_update_userfeeback_message_time.rb index 686bc496e..95bfbd2ac 100644 --- a/db/migrate/20150901004910_update_userfeeback_message_time.rb +++ b/db/migrate/20150901004910_update_userfeeback_message_time.rb @@ -1,25 +1,25 @@ class UpdateUserfeebackMessageTime < ActiveRecord::Migration def up - user_feedback_count = UserFeedbackMessage.all.count / 30 + 1 - transaction do - for i in 1 ... user_feedback_count do i - UserFeedbackMessage.page(i).per(30).each do |ufm| - if ufm.journals_for_message - if ufm.journals_for_message.respond_to?("created_at") - ufm.created_at = ufm.journals_for_message.created_at - elsif ufm.journals_for_message.respond_to?("created_on") - ufm.created_at = ufm.journals_for_message.created_on - end - puts ufm.id - ufm.save - - user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first - user_feedback_messages.created_at = ufm.created_at - user_feedback_messages.save - end - end - end - end + # user_feedback_count = UserFeedbackMessage.all.count / 30 + 1 + # transaction do + # for i in 1 ... user_feedback_count do i + # UserFeedbackMessage.page(i).per(30).each do |ufm| + # if ufm.journals_for_message + # if ufm.journals_for_message.respond_to?("created_at") + # ufm.created_at = ufm.journals_for_message.created_at + # elsif ufm.journals_for_message.respond_to?("created_on") + # ufm.created_at = ufm.journals_for_message.created_on + # end + # puts ufm.id + # ufm.save + # + # user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first + # user_feedback_messages.created_at = ufm.created_at + # user_feedback_messages.save + # end + # end + # end + # end end def down diff --git a/db/migrate/20150906025009_forge_activitues_date.rb b/db/migrate/20150906025009_forge_activitues_date.rb new file mode 100644 index 000000000..b282d1938 --- /dev/null +++ b/db/migrate/20150906025009_forge_activitues_date.rb @@ -0,0 +1,25 @@ +class ForgeActivituesDate < ActiveRecord::Migration + def up + forge_count = ForgeActivity.all.count / 30 + 2 + transaction do + for i in 1 ... forge_count do i + ForgeActivity.page(i).per(30).each do |activity| + unless activity.forge_act_type == "ProjectCreateInfo" + if activity.forge_act + unless activity.forge_act.project + # puts activity.id + activity.destroy + end + else + # puts activity.id.to_s + "----" + activity.destroy + end + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 05825bd5d..5bf838c25 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150829070453) do +ActiveRecord::Schema.define(:version => 20150906025009) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1296,11 +1296,11 @@ ActiveRecord::Schema.define(:version => 20150829070453) do create_table "student_work_tests", :force => true do |t| t.integer "student_work_id" - t.integer "homework_test_id" - t.integer "result" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "error_msg" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" end create_table "student_works", :force => true do |t| @@ -1317,6 +1317,7 @@ ActiveRecord::Schema.define(:version => 20150829070453) do t.datetime "updated_at", :null => false t.integer "late_penalty", :default => 0 t.integer "absence_penalty", :default => 0 + t.integer "system_score" end create_table "student_works_evaluation_distributions", :force => true do |t| @@ -1534,7 +1535,6 @@ ActiveRecord::Schema.define(:version => 20150829070453) do t.string "identity_url" t.string "mail_notification", :default => "", :null => false t.string "salt", :limit => 64 - t.integer "gid" end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 67bfd59c3..6813f90af 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -26,6 +26,7 @@ $(function(){ var student_work_id = $('#test-program-btn').attr('data-student-work-id'); var src = $('#program-src').val(); var title = $('#program-title').val(); + var is_test = $('input[name=is_test]').val(); if(!valid_form()){ return; @@ -33,10 +34,13 @@ $(function(){ $.post( '/student_work/program_test', - {homework: homework_id, student_work_id: student_work_id, src: src, title: title}, + {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test}, function(data,status){ tested = true; console.log(data); + if(data.index <=0){ + data.index = $('.ProResultTop').length+1; + } if (typeof cb == 'function') {cb(); return;} @@ -44,7 +48,7 @@ $(function(){ var html=bt('t:result-list',data); $('.ProResult').prepend(html); - if (data.status==0) { + if (data.status==0 && is_test != 'true') { var r=confirm("答题正确,是否立刻提交?"); if (r) { $(".HomeWorkCon form").submit(); diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index 31f0efe81..fc02146bb 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -1,6 +1,6 @@ function init_editor(params){ var editor = params.kindutil.create(params.textarea, { - resizeType : 0,minWidth:"1px",width:"100%",minHeight:"28px", + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", items:['emoticons'], afterChange:function(){//按键事件 nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 3607c3f09..fdf739bd0 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -131,4 +131,50 @@ function search_homework_by_name(url){ function (data) { } ); +} + +//提交新建作品 +function new_student_work() +{ + if(regexStudentWorkName()&®exStudentWorkDescription()) + {$("#new_student_work").submit();} +} + +function edit_student_work(id) +{ + if(regexStudentWorkName()&®exStudentWorkDescription()) + {$("#edit_student_work_" + id).submit();} +} + +//验证作品名称 +function regexStudentWorkName() +{ + var name = $.trim($("#student_work_name").val()); + + if(name=="") + { + $("#student_work_name_span").text("作品名称不能为空"); + return false; + } + else + { + $("#student_work_name_span").text(""); + return true; + } +} + +function regexStudentWorkDescription() +{ + var name = $.trim($("#student_work_description").val()); + + if(name=="") + { + $("#student_work_description_textarea").text("作品描述不能为空"); + return false; + } + else + { + $("#student_work_description_textarea").text(""); + return true; + } } \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index e65afbe1e..f8000f674 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -187,7 +187,7 @@ a:hover.grey_n_btn{ background:#717171; color:#fff;} .green_btn{ background:#28be6c; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;} a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.green_btn{ background:#14ad5a;} -.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;} +.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} a.blue_btn{background:#64bdd9;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.blue_btn{ background:#329cbd;} a.orange_btn{ background:#ff5722;color:#fff; font-weight:normal; padding:2px 10px; text-align:center; } @@ -925,6 +925,7 @@ img.ui-datepicker-trigger { text-overflow: ellipsis; margin-bottom: 3px; } +.message_title{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;} .description{display: none !important;} .ispublic-label{display: none !important;} .is_public_checkbox{display: none !important;} @@ -953,3 +954,50 @@ blockquote { background-color: #e8e8e8; } +/* 创建作品 work */ +.Newwork{ width:668px; height:418px;} +.N_top{ float:right; margin-left:390px; } +.N_con{ color:#484747; font-weight:bold; width:660px; margin-top:10px; } +.N_con p{ } +.w430{ width:470px;} +.w557{ width:557px;} +.w350{ width:350px;} +.h400{height: 400px !important;} +.w620{ width:480px; height:160px; border:1px solid #CCC;} +.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } +.bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; } +.hwork_txt{ width:560px; padding-left:5px; background:#fff;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:10px;} +a:hover.tijiao{ background:#0f99a9;} +.members_left{ float:left; width:410px; margin-right:20px; text-align:center;} +.members_left{} +.members_left ul li{ height:30px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:10px; } +.members_left ul li a{ float:left; text-align:center;} +.members_left ul li span{ float:left; text-align:center; color:#484747;} +.w150{ text-align:center; width:150px;min-height: 10px;} +.f_b{ font-weight: bold;} +.members_right label{ margin-left:15px;} +.N_search{ height:20px; border:1px solid #999;} +/* 创建作品 homework */ +.hwork_new{ color:#4c4c4c;} +.c_red{ color:#F00;} +.hwork_input{ border:1px solid #64bdd9; height:22px; width:88%; background:#fff; margin-bottom:10px; padding:5px;} +.hwork_input02{ border:1px solid #64bdd9; height:15px; width:140px; background:#fff; margin-bottom:10px; padding:5px;} +.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;} +.hwork_new ul li{ } +.ml21{ margin-left:21px;} +.ml9{ margin-left:9px;} +.hwork_ttl{height:24px;} +.hwork_ctt{height:auto; padding-left:10px;clear:both;} +.hwork_tb_{ border-bottom:3px solid #e4e4e4; text-align:center;} +.hwork_tb_ ul{height:24px;} +.hwork_tb_ li{float:left;height: 24px;width: auto; padding:0 10px;cursor:pointer;} +.hwork_normaltab { color:#15bccf ; border-bottom:3px solid #e4e4e4; } +.hwork_hovertab { color:#656767; font-weight:bold; border-bottom:3px solid #15bccf; } + +.hwork_dis{display:block; } +.hwork_undis{display:none;} +.project_none{ display:none;} +.about_project{ overflow:hidden;display:none;} +.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;} +.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;} diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 6c046d62c..b64e60831 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -210,7 +210,7 @@ span[id^=valid_user] { p.jRatingInfos { position: absolute; z-index: 9999; - background: transparent url('bg_jRatingInfos.png') no-repeat; + /*background: transparent url('bg_jRatingInfos.png') no-repeat;*/ color: #CACACA; display: none; width: 91px;