From 415f457dd414af2c11c68db9a09cf4f13ae2d59f Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 18 Jul 2015 19:13:33 +0800 Subject: [PATCH 001/378] =?UTF-8?q?dts=E6=8E=A5=E5=8F=A3=EF=BC=88=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 5 +++++ app/views/projects/_tools_expand.html.erb | 5 +++++ app/views/projects/dts_repos.html.erb | 3 +++ config/locales/projects/zh.yml | 2 ++ config/routes.rb | 3 ++- 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/views/projects/dts_repos.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e6e93947c..18240aa20 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -361,6 +361,11 @@ class ProjectsController < ApplicationController end end + # dts工具接口 + def dts_repos + render_403 unless User.current.admin? + end + #发送邮件邀请新用户 def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index e9e7492cc..50884775f 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -35,6 +35,11 @@
  • <%= link_to l(:label_project_tool_response) ,project_feedback_path(@project)%>
  • +
  • + <% if User.current.admin? %> + <%= link_to l(:label_project_dts) ,:controller => "projects", :action => "dts_repos", :id => @project.id %> + <% end %> +
  • diff --git a/app/views/projects/dts_repos.html.erb b/app/views/projects/dts_repos.html.erb new file mode 100644 index 000000000..28f0398c5 --- /dev/null +++ b/app/views/projects/dts_repos.html.erb @@ -0,0 +1,3 @@ +
    +

    <%= l(:label_project_dts) %>

    +
    \ No newline at end of file diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 92e3cdc28..72349dfe8 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -90,6 +90,8 @@ zh: label_project_tool_response: 用户反馈 label_project_news: 项目新闻 + label_project_dts: DTS测试 + label_project_overview: "项目简介" label_expend_information: 展开更多信息 label_project_create: "新建了项目" diff --git a/config/routes.rb b/config/routes.rb index 6ad495a1a..388da80de 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -387,8 +387,9 @@ RedmineApp::Application.routes.draw do get 'watcherlist', :action=> 'watcherlist' get 'invite_members', :action=> 'invite_members' get 'invite_members_by_mail', :action=> 'invite_members_by_mail' + # get 'dts_repos', :aciton => 'dts_repos' get 'send_mail_to_member', :action => 'send_mail_to_member' - match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang + match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #end post 'modules' post 'archive' From a8a1633de8d7a0d07c6cd5bd3db0bf38aeb8d646 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 18 Jul 2015 19:37:25 +0800 Subject: [PATCH 002/378] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 22 +++++++++++++++ app/views/homework_common/new.html.erb | 28 ++++++------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6e6fa7d20..706c9f39d 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,6 +18,28 @@ class HomeworkCommonController < ApplicationController end def new + @homework_type = "1" + + @homework = HomeworkCommon.new + @homework.safe_attributes = params[:homework_common] + @homework.late_penalty = 0 + @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.publish_time = Time.now.strftime('%Y-%m-%d') + + if @homework_type == "1" + #匿评作业相关属性 + @homework_detail_manual = HomeworkDetailManual.new + @homework_detail_manual.ta_proportion = 0.6 + @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.evaluation_num = 3 + @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.homework_detail_manual = @homework_detail_manual + elsif @homework_type == "2" + #编程作业相关属性 + @homework_detail_programing = HomeworkDetailPrograming.new + @homework.homework_detail_programing = @homework_detail_programing + end respond_to do |format| format.html end diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index b3e433b74..6fc0fff0e 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,27 +1,17 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= error_messages_for 'homework_common' %>

    <%= l(:label_course_homework_new)%>

    -
    - <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> - -

    - 请选择将要发布的作业类型 -

    - - - 人工评分的作业(支持匿名互评、灵活设置评分比例) - -
    - - - 自动评测的编程作业(支持C程序的自动评分) - -
    - - 下一步 - +
    + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
    From e0687c0ab316d9d3f5d77efaf9f8c65127b94694 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 20 Jul 2015 09:31:14 +0800 Subject: [PATCH 003/378] =?UTF-8?q?=E4=BA=91=E5=8C=96=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 5 +++++ app/views/projects/_tools_expand.html.erb | 5 +++++ app/views/projects/dts_yun.html.erb | 3 +++ config/locales/projects/zh.yml | 1 + config/routes.rb | 1 + 5 files changed, 15 insertions(+) create mode 100644 app/views/projects/dts_yun.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e194c32ab..9ddc513cd 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -367,6 +367,11 @@ class ProjectsController < ApplicationController @dts = Dts.all end + # dts云部署 + def dts_yun + render_403 unless User.current.admin? + end + #发送邮件邀请新用户 def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index 38104cd1e..897d99fd7 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -40,6 +40,11 @@ <%= link_to l(:label_project_dts_new) ,dts_rep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗?' } %> <% end %> +
  • + <% if User.current.admin? %> + <%= link_to l(:label_project_dts_yun) ,dts_yun_project_path(@project) %> + <% end %> +
  • diff --git a/app/views/projects/dts_yun.html.erb b/app/views/projects/dts_yun.html.erb new file mode 100644 index 000000000..3a5b233ed --- /dev/null +++ b/app/views/projects/dts_yun.html.erb @@ -0,0 +1,3 @@ +
    +

    <%= l(:label_project_dts_yun) %>

    +
    \ No newline at end of file diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 3ba438c0a..dc61b5bb0 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -92,6 +92,7 @@ zh: label_project_dts_new: DTS测试 label_project_dts_statics: DTS缺陷报告 + label_project_dts_yun: 云化部署 label_project_overview: "项目简介" label_expend_information: 展开更多信息 diff --git a/config/routes.rb b/config/routes.rb index ef88e1c26..b74fd28fd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -386,6 +386,7 @@ RedmineApp::Application.routes.draw do get 'feedback', :action => 'feedback', :as => 'project_feedback' get 'watcherlist', :action=> 'watcherlist' get 'dts_rep', :action=> 'dts_rep' + get 'dts_yun', :action=> 'dts_yun' get 'invite_members', :action=> 'invite_members' get 'invite_members_by_mail', :action=> 'invite_members_by_mail' get 'send_mail_to_member', :action => 'send_mail_to_member' From 10c0a85846e0d2c54bb214f347a9f6412231ef71 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 20 Jul 2015 12:03:10 +0800 Subject: [PATCH 004/378] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=88=86=E7=8F=AD=E8=BF=87=E6=BB=A4=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/public.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 8e16c9436..b3d16908d 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -96,6 +96,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w60{ width:60px;} .w70{ width:70px;} .w90{ width:90px;} +.w100{width: 100px;} .w210{ width:210px;} .w150{ width:150px;} .w280{ width:280px;} From b2f8494342569eed12276b7cef35769a6ccc1710 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 20 Jul 2015 15:02:32 +0800 Subject: [PATCH 005/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 44 +++++++++---------- app/views/homework_common/new.html.erb | 28 ++++++++---- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 706c9f39d..73eb97eae 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController end def new - @homework_type = "1" - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 - @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.publish_time = Time.now.strftime('%Y-%m-%d') - - if @homework_type == "1" - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.homework_detail_manual = @homework_detail_manual - elsif @homework_type == "2" - #编程作业相关属性 - @homework_detail_programing = HomeworkDetailPrograming.new - @homework.homework_detail_programing = @homework_detail_programing - end + # @homework_type = "1" + # + # @homework = HomeworkCommon.new + # @homework.safe_attributes = params[:homework_common] + # @homework.late_penalty = 0 + # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.publish_time = Time.now.strftime('%Y-%m-%d') + # + # if @homework_type == "1" + # #匿评作业相关属性 + # @homework_detail_manual = HomeworkDetailManual.new + # @homework_detail_manual.ta_proportion = 0.6 + # @homework_detail_manual.absence_penalty = 0 + # @homework_detail_manual.evaluation_num = 3 + # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.homework_detail_manual = @homework_detail_manual + # elsif @homework_type == "2" + # #编程作业相关属性 + # @homework_detail_programing = HomeworkDetailPrograming.new + # @homework.homework_detail_programing = @homework_detail_programing + # end respond_to do |format| format.html end diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 6fc0fff0e..b3e433b74 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,17 +1,27 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -<%= error_messages_for 'homework_common' %>

    <%= l(:label_course_homework_new)%>

    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> +
    + <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> + +

    + 请选择将要发布的作业类型 +

    + + + 人工评分的作业(支持匿名互评、灵活设置评分比例) + +
    + + + 自动评测的编程作业(支持C程序的自动评分) + +
    + + 下一步 + <% end%>
    From 987ff98141ded9de15a4d8a159eeadf47cfc31d3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 20 Jul 2015 15:03:42 +0800 Subject: [PATCH 006/378] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8C=89=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 2921cc825..185f448ce 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -711,19 +711,19 @@ class CoursesService " limit 0,4" active_students = User.find_by_sql(sql1) if homework_count != 0 && !better_students.empty? - latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 4,:better_students=> better_students} + latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students} end unless active_students.empty? - latest_course_dynamics <<{:type=> 7,:time=>Time.now.to_s,:count=> 4,:active_students=>active_students} + latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students} end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, - :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前"} + :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",:time=>latest_course_dynamic[:time].to_time} end end #返回数组集合 - result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] } + result.sort! { |order, newer| newer[:time] <=> order[:time] } result end From 8f1a7f47d1b20fa7ba94ef1efb99177309bc5281 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 20 Jul 2015 16:03:33 +0800 Subject: [PATCH 007/378] =?UTF-8?q?dts=E6=B5=8B=E8=AF=95=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=BF=9B=E5=BA=A6=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/dts_rep.html.erb | 95 +++++++++++++++++++++-------- config/routes.rb | 3 + 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/app/views/projects/dts_rep.html.erb b/app/views/projects/dts_rep.html.erb index e62c58283..8c2a9e0d8 100644 --- a/app/views/projects/dts_rep.html.erb +++ b/app/views/projects/dts_rep.html.erb @@ -1,30 +1,77 @@

    <%= l(:label_project_dts_statics) %>

    -

    语言:Java 总文件数:361 代码行数:48662

    - - + + +
    +
    +

    测试分析中

    +
    +
    0%
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index b74fd28fd..b460db857 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -385,8 +385,11 @@ RedmineApp::Application.routes.draw do get 'feedback', :action => 'feedback', :as => 'project_feedback' get 'watcherlist', :action=> 'watcherlist' + + # 添加dts测试工具 get 'dts_rep', :action=> 'dts_rep' get 'dts_yun', :action=> 'dts_yun' + get 'invite_members', :action=> 'invite_members' get 'invite_members_by_mail', :action=> 'invite_members_by_mail' get 'send_mail_to_member', :action => 'send_mail_to_member' From 9f72b25360b99c79786d1826267b45f2582202a3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 20 Jul 2015 16:22:18 +0800 Subject: [PATCH 008/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/student_work_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index d9ac5e935..2e6efdf0a 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,12 +1,12 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id + attr_accessible :student_work_id, :homework_test_id, :result belongs_to :homework_test belongs_to :student_work def status_to_s - case self.result + case self.result.to_i when -1 '编译出错' when -2 @@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base end def test_score - if self.result == 0 + if self.result.to_i == 0 format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) else 0 From 654a8078de1717e4f04a5fd44d767bee73d86e1c Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 20 Jul 2015 16:28:35 +0800 Subject: [PATCH 009/378] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 24 +++++++- app/views/projects/_tools_expand.html.erb | 4 +- .../{dts_rep.html.erb => dts_dep.html.erb} | 55 +++++++++---------- app/views/projects/dts_yun.html.erb | 3 - app/views/projects/soft_knowledge.html.erb | 46 ++++++++++++++++ app/views/projects/yun_dep.html.erb | 46 ++++++++++++++++ config/routes.rb | 8 ++- 7 files changed, 147 insertions(+), 39 deletions(-) rename app/views/projects/{dts_rep.html.erb => dts_dep.html.erb} (63%) delete mode 100644 app/views/projects/dts_yun.html.erb create mode 100644 app/views/projects/soft_knowledge.html.erb create mode 100644 app/views/projects/yun_dep.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9ddc513cd..2efaf591a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -362,13 +362,33 @@ class ProjectsController < ApplicationController end # dts测试工具 - def dts_rep + def dts_dep render_403 unless User.current.admin? @dts = Dts.all end # dts云部署 - def dts_yun + def yun_dep + render_403 unless User.current.admin? + end + + # 软件知识库 + def soft_knowledge + render_403 unless User.current.admin? + end + + # 在线开发平台 + def online_dev + render_403 unless User.current.admin? + end + + # 软件资源库 + def soft_file + render_403 unless User.current.admin? + end + + # 软件服务 + def soft_service render_403 unless User.current.admin? end diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index 897d99fd7..7ba58f424 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -37,12 +37,12 @@
  • <% if User.current.admin? %> - <%= link_to l(:label_project_dts_new) ,dts_rep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗?' } %> + <%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗?' } %> <% end %>
  • <% if User.current.admin? %> - <%= link_to l(:label_project_dts_yun) ,dts_yun_project_path(@project) %> + <%= link_to l(:label_project_dts_yun) ,yun_dep_project_path(@project) %> <% end %>
  • diff --git a/app/views/projects/dts_rep.html.erb b/app/views/projects/dts_dep.html.erb similarity index 63% rename from app/views/projects/dts_rep.html.erb rename to app/views/projects/dts_dep.html.erb index 8c2a9e0d8..17630c622 100644 --- a/app/views/projects/dts_rep.html.erb +++ b/app/views/projects/dts_dep.html.erb @@ -9,47 +9,42 @@ #font_color{background:yellow;text-align:center;color:white;}
    -
    -

    测试分析中

    -
    -
    0%
    -
    - -
    + +
    +
    -
    diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index b3d16908d..d0893ca3d 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -73,6 +73,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml320{ margin-left:320px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} +.mr15 {margin-right: 15px;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} From 95af2ab20b62de40ca9e3cd0769368e050f48400 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:33:54 +0800 Subject: [PATCH 060/378] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AF=BC=E5=87=BA=E5=88=97=E8=A1=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=9A=20=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=8C=BF=E8=AF=84=E8=AF=84?= =?UTF-8?q?=E5=88=86=20=E5=8C=BF=E8=AF=84=E4=BD=9C=E4=B8=9A=EF=BC=9A?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=8C=BF=E8=AF=84=E8=AF=84=E5=88=86=20?= =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=EF=BC=9A=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 70 +++++++++++++++++----- config/locales/zh.yml | 1 + 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index da2575456..3e1e0ba29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -468,22 +468,60 @@ class StudentWorkController < ApplicationController sheet1 = book.create_worksheet :name => "homework" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), - l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) - count_row = 1 - items.each do |homework| - sheet1[count_row,0]=homework.user.id - sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s - sheet1[count_row,2] = homework.user.login - sheet1[count_row,3] = homework.user.user_extensions.student_id - sheet1[count_row,4] = homework.user.mail - sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) - sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) - sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) - sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) - sheet1[count_row,10] = format_time(homework.created_at) - count_row += 1 + if @homework.homework_type == 0 #普通作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + # sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,9] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 1 #匿评作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 2 #编程作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end end book.write xls_report xls_report.string diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b2faa6319..d89ecb4f5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1835,6 +1835,7 @@ zh: excel_t_score: 教师评分 excel_ta_score: 教辅评分 excel_n_score: 匿名评分 + excel_s_score: 系统评分 excel_f_score: 成绩 excel_commit_time: 提交时间 excel_homework_score: 作业积分 From c2d41ab8db2ad8252da86128779ac1327d1faecb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:34:44 +0800 Subject: [PATCH 061/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E4=B8=8A=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 50 +++++++++---------- app/views/homework_common/new.html.erb | 28 +++++++---- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 333f86da1..4b655cf31 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,31 +18,31 @@ class HomeworkCommonController < ApplicationController end def new - @homework_type = "1" - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 - @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.publish_time = Time.now.strftime('%Y-%m-%d') - - if @homework_type == "1" - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.homework_detail_manual = @homework_detail_manual - elsif @homework_type == "2" - #编程作业相关属性 - @homework_detail_programing = HomeworkDetailPrograming.new - @homework.homework_detail_programing = @homework_detail_programing - end - respond_to do |format| - format.html - end + # @homework_type = "1" + # + # @homework = HomeworkCommon.new + # @homework.safe_attributes = params[:homework_common] + # @homework.late_penalty = 0 + # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.publish_time = Time.now.strftime('%Y-%m-%d') + # + # if @homework_type == "1" + # #匿评作业相关属性 + # @homework_detail_manual = HomeworkDetailManual.new + # @homework_detail_manual.ta_proportion = 0.6 + # @homework_detail_manual.absence_penalty = 0 + # @homework_detail_manual.evaluation_num = 3 + # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.homework_detail_manual = @homework_detail_manual + # elsif @homework_type == "2" + # #编程作业相关属性 + # @homework_detail_programing = HomeworkDetailPrograming.new + # @homework.homework_detail_programing = @homework_detail_programing + # end + # respond_to do |format| + # format.html + # end end #新建作业下一步 diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 6fc0fff0e..cdc2ceca0 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,17 +1,27 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -<%= error_messages_for 'homework_common' %>

    <%= l(:label_course_homework_new)%>

    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> +
    + <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> + +

    + 请选择将要发布的作业类型 +

    + + + 人工评分的作业(支持匿名互评、灵活设置评分比例) + +
    + + + 自动评测的编程作业(支持C/C++程序的自动评分) + +
    + + 下一步 + <% end%>
    From 8f0262618305b96a58cded2f1ec4d11c75004244 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 23 Jul 2015 10:36:51 +0800 Subject: [PATCH 062/378] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=91=E5=8C=96?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E8=BF=9B=E5=BA=A6=E6=9D=A1=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=88=90=E7=AD=89=E5=BE=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/yun_dep.html.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/projects/yun_dep.html.erb b/app/views/projects/yun_dep.html.erb index 20abf038f..7a774f4e4 100644 --- a/app/views/projects/yun_dep.html.erb +++ b/app/views/projects/yun_dep.html.erb @@ -5,27 +5,27 @@
    -

    云化部署中...

    -
    -
    0%
    +

    云化部署中....

    +
    +
    - - - - - - --> - @@ -103,12 +34,6 @@ $(".subNav").click(function(){ <%=link_to l(:field_homepage), home_path %> > <%=link_to (@center_flag ? '个人中心' : '个人主页'), user_path(@user) %> > <%=link_to @user.name, user_path(@user) %>

    - - - - - -
    @@ -200,22 +125,18 @@ $(".subNav").click(function(){ <% if @center_flag %> <% end %> From 8fba66d33010c6422272fe7fa87fb38724b8a98f Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 23 Jul 2015 15:02:26 +0800 Subject: [PATCH 065/378] =?UTF-8?q?3251=E7=BC=BA=E9=99=B7=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/account/lost_password.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 8ed93f36c..3c6c57f52 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -9,7 +9,7 @@

    - <%= text_field_tag 'mail', nil, :size => 40 %> + <%= text_field_tag 'mail', nil, :size => 40, :placeholder => '请输入注册邮箱'%> <%= submit_tag l(:button_submit) %>

    From ce17cb1da0cdf381ef0f042cf674822421ed1bcb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 15:13:18 +0800 Subject: [PATCH 066/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=8CTA=E7=9A=84=E8=AF=BE=E7=A8=8B=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E8=AF=BE=E7=A8=8B=E6=95=B0=E9=87=8F=E3=80=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=88=97=E8=A1=A8=E4=B8=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d6597f3da..fa5ce8405 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -448,7 +448,7 @@ class UsersController < ApplicationController def user_courses4show query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") - query = query.where("m.user_id = ?",@user.id) + query = query.where("m.user_id = ?",@user.id).order("#{Course.table_name}.id desc") if User.current == @user #看自己 else if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 @@ -456,13 +456,12 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? - query = query.where("( (#{Course.table_name}.updated_at=? and #{Course.table_name}.id < ?) or #{Course.table_name}.updated_atnil end From b781d22a6292a2788cfe985e518e147e137afe6d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 16:17:13 +0800 Subject: [PATCH 067/378] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=99=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 15 ++++++++++----- public/stylesheets/leftside.css | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a0a61786c..b6a961239 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -20,11 +20,10 @@ class CoursesController < ApplicationController menu_item l(:label_sort_by_influence), :only => :index before_filter :can_show_course, :except => [] - before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback] - before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses] - before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course] - before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create] - before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar] + before_filter :logged_user_by_apptoken,:only => [:show,:feedback] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :authorize_course, :only => [:show, :settings, :update, :course] + before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] @@ -809,6 +808,12 @@ class CoursesController < ApplicationController end end + #删除课程 + #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + def destroy + + end + private def allow_join course if course_endTime_timeout? course diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 50b47fff4..990c02d54 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -15,6 +15,7 @@ a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; h .pr_close{ display:block; background:url(../images/leftside.png) -1px -49px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_add{display:block; background:url(../images/leftside.png) 0px -71px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_arrow{display:block; background:url(../images/leftside.png) 0px -90px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_delete{ display:block; background:url(../images/leftside.png) -1px -157px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} a:hover.pr_info_name{ color:#3ca5c6;} .pr_info_score{ font-size:14px; color:#3e4040; } From 4ce693ad1752bd96bae3e490208350ede14fb042 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 16:49:54 +0800 Subject: [PATCH 068/378] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index c55f4b000..ed8cb8626 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -8,8 +8,9 @@ <% if @message.project %> <%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> <% elsif @message.course %> - <%=h @message.board.course.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> - <% end %> + <%=h @message.board.course.name %> - <%=h @message.board.name %>: + <%= link_to(h(@message.subject), @message_url + "?topic_id=#{@message.id}&&parent_id=#{@message.parent_id ? @message.parent_id : @message.id}",:style=>'color:#1b55a7; font-weight:bold;') %> + <% end %> <%= l(:mail_issue_title_active)%>

      From a2c2f41908f0896a85a81396d1596284f519870e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 23 Jul 2015 17:32:48 +0800 Subject: [PATCH 069/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=EF=BC=9A?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=B8=80=E6=9C=88=E7=9A=84=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 57 +++++++++++++++++++++- app/views/repositories/stats.html.erb | 8 +++ config/locales/zh.yml | 1 + 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index f5fa007a5..f71d11802 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -459,6 +459,10 @@ update data = graph_commits_per_month(@repository) when "commits_per_author" data = graph_commits_per_author(@repository) + when "author_commits_per_month" + data = graph_author_commits_per_month(@repository) + when "author_qoc_per_author" + data = graph_author_qoc_per_author(@repository) end if data headers["Content-Type"] = "image/svg+xml" @@ -536,12 +540,15 @@ update def graph_commits_per_month(repository) @date_to = Date.today @date_from = @date_to << 11 - @date_from = Date.civil(@date_from.year, @date_from.month, 1) + @date_from = Date.civil(@date_from.year, @date_from.month, 1) ## Date.new(2001,2,-1) #=> # + # commits_by_day[0] 为data 【2】为count commits_by_day = Changeset.count( :all, :group => :commit_date, :conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_month = [0] * 12 - commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last } + commits_by_day.each do |c| + commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last + end changes_by_day = Change.count( :all, :group => :commit_date, :include => :changeset, @@ -617,6 +624,52 @@ update ) graph.burn end + + # 用户每月提交次数 + def graph_author_commits_per_month(repository) + commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + + changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id]) + h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + changes_data = commits_by_author.collect {|r| h[r.first] || 0} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_per_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_plural) + ) + # graph.add_data( + # :data => changes_data, + # :title => l(:label_change_plural) + # ) + graph.burn + end + + def graph_author_qoc_per_author(repository) + + end + def check_hidden_repo project = Project.find(params[:id]) if !User.current.member_of?(project) diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index fe3bf20ac..0eb04b891 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -7,7 +7,15 @@ <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %>

      + <%# 用户每月提交代码次数 %> <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>

      +

      + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> +

      +

      + <%# 用户每月提交代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> +

      <%= link_to l(:button_back), :action => 'show', :id => @project %>

      <% html_title(l(:label_repository), l(:label_statistics)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b2faa6319..2c628894e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -715,6 +715,7 @@ zh: label_commits_per_month: 每月提交次数 label_commits_per_author: 每用户提交次数 + label_author_commits_per_month: 用户最近一月的提交次数 label_view_diff: 查看差别 label_diff_inline: 直列 label_diff_side_by_side: 并排 From 1b3c6bde69b58f98238cd2756660688ef02f5965 Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Fri, 24 Jul 2015 08:56:19 +0800 Subject: [PATCH 070/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5--?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=96=87=E6=9C=AC=E6=A1=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e8db87a7e..2c91f394f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -32,7 +32,7 @@
      - +

      取消 @@ -119,10 +119,9 @@ $(function(){ function init_editor(params){ - params.textarea.removeAttr('placeholder'); var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"100%",height:"150px", - items:['emoticons'], + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", + items:['emoticons'], afterChange:function(){//按键事件 nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); }, From 3f1852985ebe466d08d09403769a5dc18603813d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 09:00:08 +0800 Subject: [PATCH 071/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A1=B5=E9=9D=A2=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 4b655cf31..3fbd7940e 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -40,9 +40,9 @@ class HomeworkCommonController < ApplicationController # @homework_detail_programing = HomeworkDetailPrograming.new # @homework.homework_detail_programing = @homework_detail_programing # end - # respond_to do |format| - # format.html - # end + respond_to do |format| + format.html + end end #新建作业下一步 From 127a243bd27b49d54f8e0da24357bd1931e0522e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 09:18:34 +0800 Subject: [PATCH 072/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=EF=BC=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9C=80=E8=BF=91=E4=B8=80=E6=9C=88=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=AC=A1=E6=95=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 25 ++++++++++++---------- app/views/repositories/stats.html.erb | 8 +++++++ config/locales/zh.yml | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index f71d11802..cabc88f6b 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -461,6 +461,8 @@ update data = graph_commits_per_author(@repository) when "author_commits_per_month" data = graph_author_commits_per_month(@repository) + when "author_commits_six_month" + data = author_commits_six_month(@repository) when "author_qoc_per_author" data = graph_author_qoc_per_author(@repository) end @@ -540,15 +542,12 @@ update def graph_commits_per_month(repository) @date_to = Date.today @date_from = @date_to << 11 - @date_from = Date.civil(@date_from.year, @date_from.month, 1) ## Date.new(2001,2,-1) #=> # - # commits_by_day[0] 为data 【2】为count + @date_from = Date.civil(@date_from.year, @date_from.month, 1) commits_by_day = Changeset.count( :all, :group => :commit_date, :conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_month = [0] * 12 - commits_by_day.each do |c| - commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last - end + commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last } changes_by_day = Change.count( :all, :group => :commit_date, :include => :changeset, @@ -627,10 +626,15 @@ update # 用户每月提交次数 def graph_author_commits_per_month(repository) - commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id]) - commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) - - changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id]) + @date_to = Date.today + @date_from = @date_to << 1 + @date_from = Date.civil(@date_from.year, @date_from.month, 1) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + + changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} fields = commits_by_author.collect {|r| r.first} @@ -666,9 +670,8 @@ update graph.burn end - def graph_author_qoc_per_author(repository) + - end def check_hidden_repo project = Project.find(params[:id]) diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index 0eb04b891..ebb670438 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -17,5 +17,13 @@ <%# 用户每月提交代码量 %> <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %>

      +

      + <%# 用户最近六个月的提交次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> +

      +

      + <%# 用户最近一年的提交次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> +

      <%= link_to l(:button_back), :action => 'show', :id => @project %>

      <% html_title(l(:label_repository), l(:label_statistics)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2c628894e..14a00eb67 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -716,6 +716,8 @@ zh: label_commits_per_month: 每月提交次数 label_commits_per_author: 每用户提交次数 label_author_commits_per_month: 用户最近一月的提交次数 + label_author_commits_six_month: 用户最近六个月的提交次数 + label_author_commits_year: 最近一年的提交次数 label_view_diff: 查看差别 label_diff_inline: 直列 label_diff_side_by_side: 并排 From c0da9257cdc7e48e00ce411d30f3b654f2651a7b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 09:19:43 +0800 Subject: [PATCH 073/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=EF=BC=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9C=80=E8=BF=91=E5=85=AD=E4=B8=AA=E6=9C=88?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 46 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cabc88f6b..e2bfc58fe 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -670,7 +670,51 @@ update graph.burn end - + # 用户最近六个月的提交次数 + def author_commits_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, 1) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + + changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + changes_data = commits_by_author.collect {|r| h[r.first] || 0} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_plural) + ) + # graph.add_data( + # :data => changes_data, + # :title => l(:label_change_plural) + # ) + graph.burn + end def check_hidden_repo From ea8f72cce9681328dfbd57016e9594f8438759d2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 09:24:09 +0800 Subject: [PATCH 074/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9Asho?= =?UTF-8?q?w=EF=BC=9A=E4=B8=A4=E4=B8=AA=E6=B5=8B=E8=AF=95=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_programing_work_show.html.erb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 807fc80fe..7081dea8c 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -59,14 +59,6 @@
      -
    • 测试结果: - - - - -
      -
      -
    • <% if @is_teacher%>
      From 2fca0f44413ddc85ee9420d388a25886b33edc35 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 09:32:12 +0800 Subject: [PATCH 075/378] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e2bfc58fe..649f4280e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -633,17 +633,11 @@ update :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) - changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, - :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} - fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} - changes_data = commits_by_author.collect {|r| h[r.first] || 0} fields = fields + [""]*(10 - fields.length) if fields.length<10 commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 - changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10 # Remove email adress in usernames fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } @@ -663,10 +657,6 @@ update :data => commits_data, :title => l(:label_revision_plural) ) - # graph.add_data( - # :data => changes_data, - # :title => l(:label_change_plural) - # ) graph.burn end @@ -679,17 +669,11 @@ update :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) - changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, - :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} - fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} - changes_data = commits_by_author.collect {|r| h[r.first] || 0} fields = fields + [""]*(10 - fields.length) if fields.length<10 commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 - changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10 # Remove email adress in usernames fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } @@ -709,10 +693,6 @@ update :data => commits_data, :title => l(:label_revision_plural) ) - # graph.add_data( - # :data => changes_data, - # :title => l(:label_change_plural) - # ) graph.burn end From 8350d5f10bb5f7e85eaff94174475dd3e415bdda Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 24 Jul 2015 09:37:53 +0800 Subject: [PATCH 076/378] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 ++ app/api/mobile/entities/course_dynamic.rb | 25 ++++++--------- app/controllers/news_controller.rb | 2 +- app/helpers/api_helper.rb | 38 +++++++++++++++++++++++ app/services/courses_service.rb | 29 ++++++++++++----- 5 files changed, 73 insertions(+), 23 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 076e0b1c7..959e0fe30 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -250,8 +250,10 @@ module Mobile end get "course_dynamic/:id" do cs = CoursesService.new + p Time.now.to_s count = cs.all_course_dynamics(params,current_user) present :data, count, with: Mobile::Entities::CourseDynamic + p Time.now.to_s present :status, 0 end diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index fe31668ff..5be0a3d0a 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -4,9 +4,7 @@ module Mobile include Redmine::I18n def self.course_dynamic_expose(field) expose field do |c,opt| - if field == :update_time - (format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) - elsif field == :news_count + if field == :news_count obj = nil c[:dynamics].each do |d| if d[:type] == 1 @@ -45,15 +43,12 @@ module Mobile end end course_dynamic_expose :type - course_dynamic_expose :count course_dynamic_expose :course_name course_dynamic_expose :course_term course_dynamic_expose :course_time course_dynamic_expose :course_id course_dynamic_expose :course_img_url course_dynamic_expose :message - course_dynamic_expose :update_time - course_dynamic_expose :count course_dynamic_expose :news_count course_dynamic_expose :document_count course_dynamic_expose :topic_count @@ -63,15 +58,15 @@ module Mobile course_dynamic_expose :current_user_is_member course_dynamic_expose :current_user_is_teacher - expose :documents,using:Mobile::Entities::Attachment do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:documents] - end - end - obj - end + # expose :documents,using:Mobile::Entities::Attachment do |f,opt| + # obj = nil + # f[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:documents] + # end + # end + # obj + # end expose :topics,using:Mobile::Entities::Message do |f,opt| obj = nil f[:dynamics].each do |d| diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 9385c73ee..906f9eaa4 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -77,7 +77,7 @@ class NewsController < ApplicationController scope_order = scope.all(:include => [:author, :course], :order => "#{News.table_name}.created_on DESC") else - scope_order = scope.where("news.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], + scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], :order => "#{News.table_name}.created_on DESC") end diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 1f34112ad..f26f5c19b 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -1,5 +1,11 @@ # encoding: utf-8 module ApiHelper + ONE_MINUTE = 60 * 1000 + ONE_HOUR = 60 * ONE_MINUTE + ONE_DAY = 24 * ONE_HOUR + ONE_MONTH = 30 * ONE_DAY + + ONE_YEAR = 12 * ONE_MONTH #获取用户的工作单位 def get_user_work_unit user work_unit = "" @@ -163,5 +169,37 @@ module ApiHelper end + # 获取当前时间 + def time_from_now time + lastUpdateTime = time.to_i*1000 + + currentTime = Time.now.to_i*1000 + timePassed = currentTime - lastUpdateTime; + timeIntoFormat = 0 + updateAtValue = "" + if timePassed < 0 + updateAtValue = "时间有问题" + elsif timePassed < ONE_MINUTE + updateAtValue = "一分钟前" + elsif timePassed < ONE_HOUR + timeIntoFormat = timePassed / ONE_MINUTE + updateAtValue = timeIntoFormat.to_s + "分钟前" + elsif (timePassed < ONE_DAY) + timeIntoFormat = timePassed / ONE_HOUR + updateAtValue = timeIntoFormat.to_s + "小时前" + elsif (timePassed < ONE_MONTH) + timeIntoFormat = timePassed / ONE_DAY + updateAtValue = timeIntoFormat.to_s + "天前" + elsif (timePassed < ONE_YEAR) + timeIntoFormat = timePassed / ONE_MONTH + updateAtValue = timeIntoFormat.to_s + "个月前" + else + timeIntoFormat = timePassed / ONE_YEAR + updateAtValue = timeIntoFormat.to_s + "年前" + end + updateAtValue + + end + end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 185f448ce..5c3b69d72 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -654,18 +654,19 @@ class CoursesService return end if current_user == @user || current_user.admin? - membership = @user.coursememberships.page(1).per(15) + membership = @user.coursememberships else - membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user)) + membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user)) end if membership.nil? || membership.count == 0 raise l(:label_no_courses, :locale => get_user_language(current_user)) end - membership.sort! { |older, newer| newer.created_on <=> older.created_on } + #membership.sort! { |older, newer| newer.created_on <=> older.created_on } #定义一个数组集合,存放hash数组,该hash数组包括课程的信息,并包含课程的最新发布的资源,最新的讨论区留言,最新的作业,最新的通知 result = [] #对用户所有的课程进行循环,找到每个课程最新发布的资源,最新的讨论区留言,最新的作业,最新的通知,并存进数组 + membership.each do |mp| course = mp.course latest_course_dynamics = [] @@ -676,14 +677,12 @@ class CoursesService latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count, :news => latest_news.all} end - # 课程讨论区 latest_message = course.boards.first.topics.page(1).per(2) unless latest_message.first.nil? latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count, :topics => latest_message.all} end - # 课程资源 # latest_attachment = course.attachments.order("created_on desc").page(1).per(2) # unless latest_attachment.first.nil? @@ -701,7 +700,9 @@ class CoursesService homework_count = course.homework_commons.count sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" << " where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score desc limit 0,4" + better_students = User.find_by_sql(sql) + # 找出在课程讨论区发帖回帖数最多的 active_students = [] sql1 = " select users.*,count(author_id)*2 active_count from messages " << @@ -710,6 +711,7 @@ class CoursesService " GROUP BY messages.author_id ORDER BY count(author_id) desc " << " limit 0,4" active_students = User.find_by_sql(sql1) + if homework_count != 0 && !better_students.empty? latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students} end @@ -718,12 +720,25 @@ class CoursesService end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? - result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, - :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",:time=>latest_course_dynamic[:time].to_time} + result << {:course_name => course.name, + :current_user_is_member => current_user.member_of_course?(course), + :current_user_is_teacher => is_course_teacher(current_user,course), + :course_id => course.id, + :course_img_url => url_to_avatar(course), + :course_time => course.time, + :course_term => course.term, + :message => "", + :dynamics => latest_course_dynamics, + :course_student_num=>course ? course.members.count : 0, + #:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前", + :time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s, + :time=>latest_course_dynamic[:time].to_time} end + end #返回数组集合 result.sort! { |order, newer| newer[:time] <=> order[:time] } + result end From f4360e66dd62172085c254164edf8610446b7e0f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 09:47:20 +0800 Subject: [PATCH 077/378] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 4b655cf31..0a33ef87a 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -144,6 +144,8 @@ class HomeworkCommonController < ApplicationController end if homework.save + homework_detail_programing.save if homework_detail_programing + homework_detail_manual.save if homework_detail_manual respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -254,7 +256,6 @@ class HomeworkCommonController < ApplicationController client.request(request) end result = JSON.parse(res.body) - homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 end @homework.save_attachments(params[:attachments]) From e5801338d610e1338b79a99e1be1557f35cbdf58 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 09:47:28 +0800 Subject: [PATCH 078/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9C=88=E6=97=B6=E9=97=B4=E8=B7=A8=E5=BA=A6?= =?UTF-8?q?=20=E5=BD=93=E5=89=8D=E6=97=A5=E6=9C=9F=E5=BB=B6=E7=94=9F?= =?UTF-8?q?=E5=88=B0=E4=B8=8A=E6=9C=88=E7=9A=84=E5=BD=93=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 649f4280e..717007f54 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -628,7 +628,7 @@ update def graph_author_commits_per_month(repository) @date_to = Date.today @date_from = @date_to << 1 - @date_from = Date.civil(@date_from.year, @date_from.month, 1) + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) @@ -664,7 +664,7 @@ update def author_commits_six_month(repository) @date_to = Date.today @date_from = @date_to << 6 - @date_from = Date.civil(@date_from.year, @date_from.month, 1) + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) From ad43c76ce795930e3319da1efeabde985aac8173 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 10:21:52 +0800 Subject: [PATCH 079/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8F=AF=E9=85=8D=E7=BD=AE=20=E5=8C=85?= =?UTF-8?q?=E6=8B=AC=E5=9B=BE=E7=89=87=E5=A4=A7=E5=B0=8F=E3=80=81=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c03b0de76..816d6550a 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -45,10 +45,10 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> - <%= l(:label_welcome_trustie_project)%>,  - <%= l(:label_welcome_trustie_project_description)%> + + <%= @first_page.description.html_safe %> <% end %> <% else %> From bf86393bb911b64060adc5cd51fc963a638de93c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 10:39:07 +0800 Subject: [PATCH 080/378] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E4=B8=BB=E9=A1=B5=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/avatar/_avatar_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb index 632ea5d4d..43aaf9132 100644 --- a/app/views/avatar/_avatar_form.html.erb +++ b/app/views/avatar/_avatar_form.html.erb @@ -43,7 +43,7 @@
      -<%#= 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 => "btn_addPic", :style => "text-decoration:none;" %> +<%= 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 => "btn_addPic", :style => "text-decoration:none;" %> <%= l(:button_upload_photo) %> From c8cb730397a8c9a51070411ee82c3aeb1c51dc15 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 24 Jul 2015 10:56:19 +0800 Subject: [PATCH 081/378] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/course_dynamic.rb | 109 ++++++++-------------- app/services/courses_service.rb | 30 ++++-- 2 files changed, 62 insertions(+), 77 deletions(-) diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index 5be0a3d0a..6077a8722 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -4,45 +4,44 @@ module Mobile include Redmine::I18n def self.course_dynamic_expose(field) expose field do |c,opt| - if field == :news_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:count] - end - end - obj - elsif field == :document_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:count] - end - end - obj - elsif field == :topic_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:count] - end - end - obj - elsif field == :homework_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:count] - end - end - obj - else + # if field == :news_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 1 + # obj = d[:count] + # end + # end + # obj + # elsif field == :document_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:count] + # end + # end + # obj + # elsif field == :topic_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 2 + # obj = d[:count] + # end + # end + # obj + # elsif field == :homework_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 4 + # obj = d[:count] + # end + # end + # obj + # else c[field] if (c.is_a?(Hash) && c.key?(field)) - end + # end end end - course_dynamic_expose :type course_dynamic_expose :course_name course_dynamic_expose :course_term course_dynamic_expose :course_time @@ -68,52 +67,22 @@ module Mobile # obj # end expose :topics,using:Mobile::Entities::Message do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:topics] - end - end - obj + f[:topics] end expose :homeworks,using:Mobile::Entities::Homework do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:homeworks] - end - end - obj + f[:homeworks] end expose :news,using:Mobile::Entities::News do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:news] - end - end - obj + f[:news] end expose :better_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 6 - obj = d[:better_students] - end - end - obj + f[:better_students] end expose :active_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 7 - obj = d[:active_students] - end - end - obj + f[:active_students] end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 5c3b69d72..274b78e50 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -670,18 +670,25 @@ class CoursesService membership.each do |mp| course = mp.course latest_course_dynamics = [] + notices_count = 0 + topic_count = 0 + topics = nil + homeworkss = nil + notices = nil # 课程通知 latest_news = course.news.page(1).per(2).order("created_on desc") unless latest_news.first.nil? - latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count, - :news => latest_news.all} + notices_count = course.news.count + notices = latest_news.all + latest_course_dynamics << {:time => latest_news.first.created_on } end # 课程讨论区 latest_message = course.boards.first.topics.page(1).per(2) unless latest_message.first.nil? - latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count, - :topics => latest_message.all} + topic_count = course.boards.nil? ? 0 : course.boards.first.topics.count + topics = latest_message.all + latest_course_dynamics << {:time => latest_message.first.created_on} end # 课程资源 # latest_attachment = course.attachments.order("created_on desc").page(1).per(2) @@ -693,7 +700,8 @@ class CoursesService #课程作业 已经交的学生列表(暂定显示6人),未交的学生列表,作业的状态 homeworks = course.homework_commons.page(1).per(2).order('created_at desc') unless homeworks.first.nil? - latest_course_dynamics << {:type => 4, :time => homeworks.first.updated_at, :count=>course.homework_commons.count , :homeworks => homeworks} + homeworkss = homeworks + latest_course_dynamics << {:time => homeworks.first.updated_at} end latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] } # 课程学霸 学生总分数排名靠前的5个人 @@ -713,10 +721,10 @@ class CoursesService active_students = User.find_by_sql(sql1) if homework_count != 0 && !better_students.empty? - latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end unless active_students.empty? - latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? @@ -727,6 +735,14 @@ class CoursesService :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term, + :news_count => notices_count, + :homework_count => homework_count, + :topic_count => topic_count, + :news => notices, + :homeworks => homeworkss, + :topics => topics, + :better_students => better_students, + :active_students => active_students, :message => "", :dynamics => latest_course_dynamics, :course_student_num=>course ? course.members.count : 0, From a4734bb1356814f8f133218cc90fbd027fdd4bfe Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 24 Jul 2015 11:13:53 +0800 Subject: [PATCH 082/378] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 274b78e50..c2944fed5 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -744,7 +744,6 @@ class CoursesService :better_students => better_students, :active_students => active_students, :message => "", - :dynamics => latest_course_dynamics, :course_student_num=>course ? course.members.count : 0, #:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前", :time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s, From 938d31a7612e469ea1d78c7b6c0d103cb69a6c84 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 11:36:21 +0800 Subject: [PATCH 083/378] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BE=97=E5=88=86?= =?UTF-8?q?=E4=B8=BA0=20=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=B9=E7=9B=AE=E5=BE=97=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_projects.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 972b3b3a6..b168e5f81 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -80,11 +80,13 @@
      <% if @project.project_type == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id}, :class => "c_orange f14" ) %> + <% unless project_scores(@project) == 0 %> + <%= l(:label_project_score)%> : + <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "c_orange f14" ) %> + <% end %> <% end %>
      From f521ca424d6a0a0649af8f73dc357110c5db2958 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 24 Jul 2015 11:47:45 +0800 Subject: [PATCH 084/378] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 959e0fe30..076e0b1c7 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -250,10 +250,8 @@ module Mobile end get "course_dynamic/:id" do cs = CoursesService.new - p Time.now.to_s count = cs.all_course_dynamics(params,current_user) present :data, count, with: Mobile::Entities::CourseDynamic - p Time.now.to_s present :status, 0 end From 0e56a79622e78faad107c8fba7613fd21f771929 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 11:50:50 +0800 Subject: [PATCH 085/378] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8D=E4=BD=BF=E7=94=A8ajax=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 3 +-- app/views/news/_course_news.html.erb | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 9385c73ee..848c0a69d 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -71,8 +71,7 @@ class NewsController < ApplicationController scope = @course ? @course.news.course_visible : News.course_visible @news_count = scope.count - #@news_pages = Paginator.new @news_count, @limit, params['page'] - #@offset ||= scope_page.offset + @q = params[:subject] if params[:subject].nil? scope_order = scope.all(:include => [:author, :course], :order => "#{News.table_name}.created_on DESC") diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index f801aff87..e2c50fe24 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -24,8 +24,8 @@ <% end %>
      @@ -34,7 +34,7 @@
      <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %> -
      +
      <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= stylesheet_link_tag 'scm' %> From 2f497f36d0ff7381b3e7a1ee83b8c69a734fa8f9 Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Fri, 24 Jul 2015 14:00:02 +0800 Subject: [PATCH 086/378] =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=90=8E=E5=BB=BA=E8=AE=AE=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E2=80=9C=E5=AF=86=E7=A0=81=E4=BF=AE=E6=94=B9=E6=88=90=E5=8A=9F?= =?UTF-8?q?=EF=BC=8C=E8=AF=B7=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E2=80=9D?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index c23266afd..57c3712f9 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -540,6 +540,7 @@ $('#my_account_form_btn').click(); }); $('#my_password_form_link').click(function(){ + alert("密码修改成功,请重新登录!"); $('#my_password_form_btn').click(); }); }); From 518ce15df5a9d13e1058c9f8fb4676fa4ec0345c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 14:01:15 +0800 Subject: [PATCH 087/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=88=90=E5=91=98=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/projects/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 6c2646acf..e47cd476c 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -350,7 +350,7 @@ zh: label_input_email: 请输入邮箱地址 label_invite_trustie_user: "邀请Trustie注册用户" - label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" + label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!" label_user_role_null: 用户和角色不能留空! label_invite_project: 邀请您加入项目 label_mail_invite_success: 您已成功加入项目! From 430956bfe54f90c1aa24307de0224f7f69f8277e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 14:24:31 +0800 Subject: [PATCH 088/378] =?UTF-8?q?=E6=88=91=E8=A6=81=E5=8F=8D=E9=A6=88---?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E7=BC=96=E8=BE=91=E6=A1=86=E6=97=B6=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index a9633861e..270618522 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5104,8 +5104,8 @@ KEditor.prototype = { } } }); - statusbar.removeClass('statusbar').addClass('ke-statusbar') - .append(''); + //statusbar.removeClass('statusbar').addClass('ke-statusbar') + // .append(''); if (self._fullscreenResizeHandler) { K(window).unbind('resize', self._fullscreenResizeHandler); self._fullscreenResizeHandler = null; From 24a9a5034c19897ffa7669e6c94c543cc0650d5f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 14:27:30 +0800 Subject: [PATCH 089/378] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=AF=BC=E5=87=BA=E9=99=84=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 781277b57..fc82aea1e 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -55,21 +55,23 @@ <% end%> <% if @is_teacher%>
      - <% if @homework.student_works.empty?%> - <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> - <% else%> - <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), - remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% unless @homework.homework_type == 2%> + <% if @homework.student_works.empty?%> + <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> + <% else%> + <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), + remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% end%> +
      + 使用 + winzip + 工具进行解压可能会导致 + 下载文件乱码 + ,建议您使用 + winrar + 工具进行解压 +
      <% end%> -
      - 使用 - winzip - 工具进行解压可能会导致 - 下载文件乱码 - ,建议您使用 - winrar - 工具进行解压 -
      <%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> From cf58ea8a9f9a9ff8591962d2cc0c4b6831d26c8f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 14:31:08 +0800 Subject: [PATCH 090/378] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 57c3712f9..0d8159c89 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -540,7 +540,7 @@ $('#my_account_form_btn').click(); }); $('#my_password_form_link').click(function(){ - alert("密码修改成功,请重新登录!"); +// alert("密码修改成功,请重新登录!"); $('#my_password_form_btn').click(); }); }); From 4a781ea6b23cde56f39e4b72ce4f2774640a0f25 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 14:36:53 +0800 Subject: [PATCH 091/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=8C=E5=8A=A9=E6=95=99=E4=B8=8D=E5=8F=AF=E4=BB=A5=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E8=AF=BE=E7=A8=8B=E3=80=82=E4=BF=AE=E6=94=B9=E5=BC=A0?= =?UTF-8?q?=E7=94=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a1c7ae875..1623979f0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -604,7 +604,7 @@ class CoursesController < ApplicationController def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) - unless (@course_prefs.student != User.current || User.current.admin?) + unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?) render_403 end end From 390aa632cdeb93b8bffeded6611ca16eb4f197f0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 15:02:01 +0800 Subject: [PATCH 092/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=B8=BB=E7=89=88=E6=9C=AC=E5=BA=93=E5=90=8E=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE=E4=B8=BB=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 5cbc3af5a..c77eba0c5 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -236,13 +236,14 @@ module RepositoriesHelper # 判断项目是否有主版本库 def judge_main_repository(pro) if pro.repositories.blank? - return false + status = false else - pro.repositories.sort.each do |rep| - rep.is_default? - return true + pro.repositories.each do |rep| + status = true and break if rep.is_default? + status = false end end + status end # def cvs_field_tags(form, repository) # content_tag('p', form.text_field( From 4f8170700e7702e87d3a7daeb8a8b2fae3d9214d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 15:19:01 +0800 Subject: [PATCH 093/378] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 24 ++++++++++++++++++------ app/views/student_work/index.html.erb | 22 +++++++++++++++++++++- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 2de96bca1..c0f716ed7 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -71,18 +71,30 @@ <% end%> +
      + +
      + 开发语言: +
      + <% if homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
      +
      +
      <% end%> -
      -
      - <% unless homework.attachments.empty?%> + <% unless homework.attachments.empty?%> +
      附件:
      <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
      - <% end%> -
      -
      +
      +
      + <% end%>
      扣分标准: diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index fc82aea1e..92f6f93e0 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -139,6 +139,14 @@ <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + "> + + + <% @homework.homework_tests.each do |test|%> ">
      + 输入 + + 输出 +
      @@ -151,8 +159,20 @@ <% end%>
      +
      + +
      + 开发语言: +
      + <% if @homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif @homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
      +
      +
      <% end%> -
      <% unless @homework.attachments.empty?%> From 6c894e63eeade3c1c7e57b588cbea32b33d75fa4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 15:54:09 +0800 Subject: [PATCH 094/378] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=88=86=E7=8F=AD=E7=9A=84=E9=95=BF=E5=BA=A6=E9=99=90?= =?UTF-8?q?=E5=AE=9A=E4=B8=BA20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_groups_name.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/courses/_new_groups_name.html.erb b/app/views/courses/_new_groups_name.html.erb index 39fa33677..fc2c5a62d 100644 --- a/app/views/courses/_new_groups_name.html.erb +++ b/app/views/courses/_new_groups_name.html.erb @@ -31,7 +31,7 @@ <% if @canShowCode%> <%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, :id => 'update_group_'+group.id.to_s) do %> <% end %> @@ -47,7 +47,7 @@
    • From 6b3882aff8853902a994b40730743fb10f252bfb Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Fri, 24 Jul 2015 16:33:53 +0800 Subject: [PATCH 095/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=9A=E5=A6=82=E5=9B=BE=E5=80=BC=E4=B8=BA0=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=BF=99=E4=BA=9B=E5=AD=97=E6=AE=B5=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users_new.html.erb | 72 +++++++++++++++++------ app/views/my/account.html.erb | 1 - 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index bbfe9a1ea..4b6bd2887 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -149,29 +149,65 @@
        <% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %> -
      • 创建课程 :
      • -
      • 发布作业 :
      • + <% if(get_create_course_count(@user)) == 0 %> +
      • 创建课程 :
      • + <% end %> + <% if(get_homework_commons_count(@user)) == 0 %> +
      • 发布作业 :
      • + <% end %> + <% end %> + <% if (get_join_course_count(@user) != 0) %> +
      • 加入课程 :
      • + <% end %> + <% if @user.user_extensions.identity == 0 %> +
      • 参加匿评 :
      • + <% end %> + <% if (get_projectandcourse_attachment_count(@user) != 0) %> +
      • 发布资源 :
      • + <% end %> + <% if (get_create_project_count(@user) != 0) %> +
      • 创建项目 :
      • + <% end %> + <% if (get_join_project_count(@user) != 0) %> +
      • 加入项目 :
      • + <% end %> + <% if (get_create_issue_count(@user) != 0) %> +
      • 发布缺陷 :
      • + <% end %> + <% if (get_resolve_issue_count(@user) != 0) %> +
      • 解决缺陷 :
      • <% end %> -
      • 加入课程 :
      • -
      • 参加匿评 :
      • -
      • 发布资源 :
      • -
      • 创建项目 :
      • -
      • 加入项目 :
      • -
      • 发布缺陷 :
      • -
      • 解决缺陷 :
        <% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %> -
      • <%= get_create_course_count(@user) %>
      • -
      • <%= get_homework_commons_count(@user) %>
      • + <% if(get_create_course_count(@user)) == 0 %> +
      • <%= get_create_course_count(@user) %>
      • + <% end %> + <% if(get_homework_commons_count(@user)) == 0 %> +
      • <%= get_homework_commons_count(@user) %>
      • + <% end %> + <% end %> + <% if (get_join_course_count(@user) != 0) %> +
      • <%= get_join_course_count(@user) %>
      • + <% end %> + <% if @user.user_extensions.identity == 0 %> +
      • <%= get_anonymous_evaluation_count(@user) %>
      • + <% end %> + <% if (get_projectandcourse_attachment_count(@user) != 0) %> +
      • <%= get_projectandcourse_attachment_count(@user) %>
      • + <% end %> + <% if (get_create_project_count(@user) != 0) %> +
      • <%= get_create_project_count(@user) %>
      • + <% end %> + <% if (get_join_project_count(@user) != 0) %> +
      • <%= get_join_project_count(@user) %>
      • + <% end %> + <% if (get_create_issue_count(@user) != 0) %> +
      • <%= get_create_issue_count(@user) %>
      • + <% end %> + <% if (get_resolve_issue_count(@user) != 0) %> +
      • <%= get_resolve_issue_count(@user) %>
      • <% end %> -
      • <%= get_join_course_count(@user) %>
      • -
      • <%= get_anonymous_evaluation_count(@user) %>
      • -
      • <%= get_projectandcourse_attachment_count(@user) %>
      • -
      • <%= get_create_project_count(@user) %>
      • -
      • <%= get_join_project_count(@user) %>
      • -
      • <%= get_create_issue_count(@user) %>
      • -
      • <%= get_resolve_issue_count(@user) %>
      diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 57c3712f9..c23266afd 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -540,7 +540,6 @@ $('#my_account_form_btn').click(); }); $('#my_password_form_link').click(function(){ - alert("密码修改成功,请重新登录!"); $('#my_password_form_btn').click(); }); }); From 71970e1942f2b00f43ed92af4e7d65a113608359 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 24 Jul 2015 16:53:21 +0800 Subject: [PATCH 096/378] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8C=89=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=AE=B5=E6=9D=A5=E7=BB=9F=E8=AE=A1=E6=AF=8F=E4=BA=BA?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E4=BA=A4=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository/git.rb | 4 ++++ lib/redmine/scm/adapters/git_adapter.rb | 29 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index c1f0020eb..f3ea8e003 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -38,6 +38,10 @@ class Repository::Git < Repository 'Git' end + def commits(authors, start_date, end_date) + scm.commits(authors, start_date, end_date) + end + def report_last_commit extra_report_last_commit end diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 1876190d9..81c361f6e 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -380,6 +380,35 @@ module Redmine nil end + def parse_commit(commits) + sum = {file: 0, insertion: 0, deletion: 0} + commits.split("\n").each do |commit| + if /(\d+)\s+?file/ =~ commit + sum[:file] += $1 .to_i + end + if /(\d+)\s+?insertion/ =~ commit + sum[:insertion] += $1.to_i + end + if /(\d+)\s+?deletion/ =~ commit + sum[:deletion] += $1.to_i + end + end + sum[:insertion] + sum[:deletion] + end + + def commits(authors, start_date, end_date) + rs = [] + authors.each do |author| + cmd_args = %W|log --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| + commits = '' + git_cmd(cmd_args) do |io| + commits = io.read + end + rs << {author: author, num: parse_commit(commits)} + end + rs + end + class Revision < Redmine::Scm::Adapters::Revision # Returns the readable identifier def format_identifier From 69b9cbee80125e0c1043a87d036f69caa5cc4d3e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 16:56:37 +0800 Subject: [PATCH 097/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=9F=E8=AE=A1=EF=BC=88=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/stats.html.erb | 8 ++++++++ config/locales/zh.yml | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index ebb670438..ba14e18b1 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -25,5 +25,13 @@ <%# 用户最近一年的提交次数 %> <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %>

      +

      + <%# 用户最近六个月的代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> +

      +

      + <%# 用户最近一年的代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_year")) %> +

      <%= link_to l(:button_back), :action => 'show', :id => @project %>

      <% html_title(l(:label_repository), l(:label_statistics)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9b3254bb2..a5f4f4d10 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -716,8 +716,10 @@ zh: label_commits_per_month: 每月提交次数 label_commits_per_author: 每用户提交次数 label_author_commits_per_month: 用户最近一月的提交次数 - label_author_commits_six_month: 用户最近六个月的提交次数 + label_author_commits_six_month: 用户最近六个月提交次数 label_author_commits_year: 最近一年的提交次数 + label_author_code_six_month: 用户最近六个月代码量 + label_author_code_year: 用户最近一年代码量 label_view_diff: 查看差别 label_diff_inline: 直列 label_diff_side_by_side: 并排 From 19e60f753fb71ca1faba2f59c4e7a42621d133bd Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 17:14:55 +0800 Subject: [PATCH 098/378] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 44 +++++++++---------- app/views/homework_common/new.html.erb | 28 ++++-------- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 34e97e4dd..5324a0d38 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController end def new - # @homework_type = "1" - # - # @homework = HomeworkCommon.new - # @homework.safe_attributes = params[:homework_common] - # @homework.late_penalty = 0 - # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - # @homework.publish_time = Time.now.strftime('%Y-%m-%d') - # - # if @homework_type == "1" - # #匿评作业相关属性 - # @homework_detail_manual = HomeworkDetailManual.new - # @homework_detail_manual.ta_proportion = 0.6 - # @homework_detail_manual.absence_penalty = 0 - # @homework_detail_manual.evaluation_num = 3 - # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - # @homework.homework_detail_manual = @homework_detail_manual - # elsif @homework_type == "2" - # #编程作业相关属性 - # @homework_detail_programing = HomeworkDetailPrograming.new - # @homework.homework_detail_programing = @homework_detail_programing - # end + @homework_type = "1" + + @homework = HomeworkCommon.new + @homework.safe_attributes = params[:homework_common] + @homework.late_penalty = 0 + @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.publish_time = Time.now.strftime('%Y-%m-%d') + + if @homework_type == "1" + #匿评作业相关属性 + @homework_detail_manual = HomeworkDetailManual.new + @homework_detail_manual.ta_proportion = 0.6 + @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.evaluation_num = 3 + @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.homework_detail_manual = @homework_detail_manual + elsif @homework_type == "2" + #编程作业相关属性 + @homework_detail_programing = HomeworkDetailPrograming.new + @homework.homework_detail_programing = @homework_detail_programing + end respond_to do |format| format.html end diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index cdc2ceca0..6fc0fff0e 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,27 +1,17 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= error_messages_for 'homework_common' %>

      <%= l(:label_course_homework_new)%>

      -
      - <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> - -

      - 请选择将要发布的作业类型 -

      - - - 人工评分的作业(支持匿名互评、灵活设置评分比例) - -
      - - - 自动评测的编程作业(支持C/C++程序的自动评分) - -
      - - 下一步 - +
      + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
      From 9a9658baf3f0d14188d5b4241f7733a59e3834c9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 24 Jul 2015 17:28:46 +0800 Subject: [PATCH 099/378] =?UTF-8?q?l=E7=95=99=E8=A8=80=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_header.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 16fa44c73..c4f61d73c 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -34,7 +34,7 @@
    • <%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', - { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user }, + {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, {:class => 'my-message'} if User.current.logged?%>
    From ea93a68a84137bbc3787922130c411cfcfbf3848 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 17:40:43 +0800 Subject: [PATCH 100/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=EF=BC=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=85=AD=E4=B8=AA=E6=9C=88=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=87=8F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 717007f54..fc05b082d 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -465,6 +465,8 @@ update data = author_commits_six_month(@repository) when "author_qoc_per_author" data = graph_author_qoc_per_author(@repository) + when "author_code_six_months" + data = author_code_six_month(@repository) end if data headers["Content-Type"] = "image/svg+xml" @@ -696,6 +698,47 @@ update graph.burn end + # 最近六个月代码量统计 + def author_code_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + all_author = [] + commits_by_author.each do |cba| + all_author << cba.first + end + all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } + commits_by_author = repository.commits(all_author, @date_from, @date_to) + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_plural) + ) + graph.burn + end + def check_hidden_repo project = Project.find(params[:id]) From 0a300724d318a339c433c39225674b48bd6de35d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 24 Jul 2015 22:54:42 +0800 Subject: [PATCH 101/378] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=95=B0=E7=BB=84=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository/git.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index f3ea8e003..041175572 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -39,7 +39,9 @@ class Repository::Git < Repository end def commits(authors, start_date, end_date) - scm.commits(authors, start_date, end_date) + scm.commits(authors, start_date, end_date).map {|commit| + [commit[:author], commit[:num]] + } end def report_last_commit From b9a902bb041baaafcd926c6aa6adf26e055526e7 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 23:09:28 +0800 Subject: [PATCH 102/378] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index fc05b082d..ada42e1f2 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -729,7 +729,7 @@ update :scale_integers => true, :show_data_values => true, :rotate_y_labels => false, - :graph_title => l(:label_author_commits_six_month), + :graph_title => l(:label_author_code_six_month), :show_graph_title => true ) graph.add_data( From 0a1afd7c450cb80dbd77ef9bd4968a234b5589c3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 23:25:56 +0800 Subject: [PATCH 103/378] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ada42e1f2..bc3c0af02 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,6 +711,8 @@ update end all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } commits_by_author = repository.commits(all_author, @date_from, @date_to) + logger.info "start******************************************************************" + commits_by_author + logger.info "end**************************************************************8" fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} @@ -719,7 +721,7 @@ update commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 # Remove email adress in usernames - fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + # fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } graph = SVG::Graph::BarHorizontal.new( :height => 400, From 6aa332d1f66fda984da852a7ce54d9ca5222c27e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 23:36:24 +0800 Subject: [PATCH 104/378] =?UTF-8?q?=E8=B0=83=E8=AF=95=E3=80=81=E6=89=93?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index bc3c0af02..d15b581f6 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,8 +711,7 @@ update end all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } commits_by_author = repository.commits(all_author, @date_from, @date_to) - logger.info "start******************************************************************" + commits_by_author - logger.info "end**************************************************************8" + Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} @@ -721,7 +720,7 @@ update commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 # Remove email adress in usernames - # fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } graph = SVG::Graph::BarHorizontal.new( :height => 400, From c339e9071bf91752cc2ead3dcaa07956830abf00 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jul 2015 23:55:13 +0800 Subject: [PATCH 105/378] =?UTF-8?q?date=E7=B1=BB=E5=9E=8B=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=88=90string=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index d15b581f6..03ab9d2e3 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -710,7 +710,7 @@ update all_author << cba.first end all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } - commits_by_author = repository.commits(all_author, @date_from, @date_to) + commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}") Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From 088e9b200a8e1b44759e97ad7b116f4bf071f1e9 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 25 Jul 2015 00:05:28 +0800 Subject: [PATCH 106/378] =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 03ab9d2e3..e59d90052 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -710,7 +710,7 @@ update all_author << cba.first end all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } - commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}") + commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24") Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From a04fe786ea246b10769f2da61a2d813e94e394d1 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 25 Jul 2015 00:24:59 +0800 Subject: [PATCH 107/378] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D=E5=90=8E=E7=9A=84=E7=A9=BA=E6=A0=BC=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8C=BA=E9=97=B4=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e59d90052..3dee2af3e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -709,7 +709,8 @@ update commits_by_author.each do |cba| all_author << cba.first end - all_author = all_author.collect {|c| c.gsub(%r{<.+@.+>}, '') } + # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } + all_author = all_author.collect {|c| c.split.first } commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24") Rails.logger.debug "######################################{commits_by_author}" From 5732d9cee24e10b04a1ba49c713325c34ee8321b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 25 Jul 2015 10:17:03 +0800 Subject: [PATCH 108/378] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/redmine/scm/adapters/git_adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 81c361f6e..6c56a7e24 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -404,6 +404,7 @@ module Redmine git_cmd(cmd_args) do |io| commits = io.read end + logger.info "git log output for #{author} #{commits}" rs << {author: author, num: parse_commit(commits)} end rs From bf5f7f8d4f8d1b2ab5ae3969fa7b6a696a11b01a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 25 Jul 2015 11:18:09 +0800 Subject: [PATCH 109/378] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository/git.rb | 4 ++-- lib/redmine/scm/adapters/git_adapter.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 041175572..7c484e87f 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -38,8 +38,8 @@ class Repository::Git < Repository 'Git' end - def commits(authors, start_date, end_date) - scm.commits(authors, start_date, end_date).map {|commit| + def commits(authors, start_date, end_date, branch='master') + scm.commits(authors, start_date, end_date,branch).map {|commit| [commit[:author], commit[:num]] } end diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 6c56a7e24..927018b34 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -396,10 +396,10 @@ module Redmine sum[:insertion] + sum[:deletion] end - def commits(authors, start_date, end_date) + def commits(authors, start_date, end_date, branch='master') rs = [] authors.each do |author| - cmd_args = %W|log --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| + cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| commits = '' git_cmd(cmd_args) do |io| commits = io.read From 59a3072f818b67fea6ce275a7a8a4d984825cb4a Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 25 Jul 2015 11:20:11 +0800 Subject: [PATCH 110/378] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3dee2af3e..092d50843 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,7 +711,7 @@ update end # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } all_author = all_author.collect {|c| c.split.first } - commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24") + commits_by_author = repository.commits(all_author, "2014-01-24", "2015-07-24") Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From 405104c403e779650f0ebab4f7b2f2f3ac43f360 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 25 Jul 2015 11:46:29 +0800 Subject: [PATCH 111/378] =?UTF-8?q?=E4=BC=A0=E5=85=A5@rev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 092d50843..8243a88cd 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,7 +711,7 @@ update end # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } all_author = all_author.collect {|c| c.split.first } - commits_by_author = repository.commits(all_author, "2014-01-24", "2015-07-24") + commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24", @rev) Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From 51e027fdc3c994c246dd5bf1b5178b73d4c9b30b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 25 Jul 2015 12:02:30 +0800 Subject: [PATCH 112/378] =?UTF-8?q?szzh=E7=89=B9=E6=AE=8A=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 8243a88cd..781bf0766 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,7 +711,7 @@ update end # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } all_author = all_author.collect {|c| c.split.first } - commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24", @rev) + commits_by_author = repository.commits(all_author, "2015-01-24", "2015-07-24", repository.id == 150 ? "szzh" : 'master') Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From fbc0f074d4d2d847e4c7757897768d1d80fdb688 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 25 Jul 2015 12:04:06 +0800 Subject: [PATCH 113/378] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=87=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 092d50843..08799ef01 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -711,7 +711,7 @@ update end # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } all_author = all_author.collect {|c| c.split.first } - commits_by_author = repository.commits(all_author, "2014-01-24", "2015-07-24") + commits_by_author = repository.commits(all_author, '@date_from', "@date_to", "szzh") Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} From b320a02976bca784de19541f105233d263d9a366 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 25 Jul 2015 12:06:21 +0800 Subject: [PATCH 114/378] =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 08799ef01..fc441e238 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -712,7 +712,6 @@ update # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } all_author = all_author.collect {|c| c.split.first } commits_by_author = repository.commits(all_author, '@date_from', "@date_to", "szzh") - Rails.logger.debug "######################################{commits_by_author}" fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} From 839cbf2a5565ccdfe959a2c4682efcf53a6c554d Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 26 Jul 2015 13:43:56 +0800 Subject: [PATCH 115/378] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E5=B9=B4?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 13 +++++++------ config/locales/zh.yml | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 355033b8f..bbc3e1596 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -626,14 +626,14 @@ update graph.burn end - # 用户每月提交次数 + # 用户最近一年的提交次数 def graph_author_commits_per_month(repository) @date_to = Date.today - @date_from = @date_to << 1 + @date_from = @date_to << 12 @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} @@ -652,8 +652,9 @@ update :scale_integers => true, :show_data_values => true, :rotate_y_labels => false, - :graph_title => l(:label_author_commits_per_month), - :show_graph_title => true + :graph_title => l(:label_author_commits_year), + :show_graph_title => true, + :no_css => true ) graph.add_data( :data => commits_data, @@ -735,7 +736,7 @@ update ) graph.add_data( :data => commits_data, - :title => l(:label_revision_plural) + :title => l(:lable_revision_code_count) ) graph.burn end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index a5f4f4d10..78e8379dc 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -669,6 +669,7 @@ zh: label_tag: 标签 label_revision: 修订 label_revision_plural: 修订 + lable_revision_code_count: 代码量 label_revision_id: 修订 %{value} label_associated_revisions: 相关修订版本 label_added: 已添加 From d89cba7a1fa9338a2c1baa70acda2c66770e4f9d Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 26 Jul 2015 14:12:26 +0800 Subject: [PATCH 116/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index bbc3e1596..41b44b6cd 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -670,7 +670,7 @@ update @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} @@ -705,7 +705,7 @@ update @date_from = @date_to << 6 @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) all_author = [] commits_by_author.each do |cba| all_author << cba.first @@ -734,6 +734,10 @@ update :graph_title => l(:label_author_code_six_month), :show_graph_title => true ) + commits_data1 = [0]*12 + graph.add_data( + :data => commits_data1, + ) graph.add_data( :data => commits_data, :title => l(:lable_revision_code_count) From 46272a28cf42d41bd44257a5874dcce248ab2763 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 26 Jul 2015 14:15:25 +0800 Subject: [PATCH 117/378] = --- app/controllers/repositories_controller.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 41b44b6cd..303e4a213 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -705,7 +705,7 @@ update @date_from = @date_to << 6 @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) - commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) all_author = [] commits_by_author.each do |cba| all_author << cba.first @@ -734,10 +734,6 @@ update :graph_title => l(:label_author_code_six_month), :show_graph_title => true ) - commits_data1 = [0]*12 - graph.add_data( - :data => commits_data1, - ) graph.add_data( :data => commits_data, :title => l(:lable_revision_code_count) From f37cbd3e0d6b137431044ae04422e077cbcd9eb3 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 26 Jul 2015 14:35:41 +0800 Subject: [PATCH 118/378] =?UTF-8?q?=E4=BF=AE=E8=AE=A2=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 ++-- config/locales/zh.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 303e4a213..752df72ee 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -658,7 +658,7 @@ update ) graph.add_data( :data => commits_data, - :title => l(:label_revision_plural) + :title => l(:label_revision_commit_count) ) graph.burn end @@ -694,7 +694,7 @@ update ) graph.add_data( :data => commits_data, - :title => l(:label_revision_plural) + :title => l(:label_revision_commit_count) ) graph.burn end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 78e8379dc..83ccebbe9 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -670,6 +670,7 @@ zh: label_revision: 修订 label_revision_plural: 修订 lable_revision_code_count: 代码量 + label_revision_commit_count: 提交次数 label_revision_id: 修订 %{value} label_associated_revisions: 相关修订版本 label_added: 已添加 From 26166abc44a7a945578fbef2d5979ea9fe49349b Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 27 Jul 2015 07:08:37 +0800 Subject: [PATCH 119/378] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=86=97=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 -- app/views/repositories/stats.html.erb | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 752df72ee..208a8bdb0 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -463,8 +463,6 @@ update data = graph_author_commits_per_month(@repository) when "author_commits_six_month" data = author_commits_six_month(@repository) - when "author_qoc_per_author" - data = graph_author_qoc_per_author(@repository) when "author_code_six_months" data = author_code_six_month(@repository) end diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index ba14e18b1..b5283629c 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -13,25 +13,13 @@

    <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>

    -

    - <%# 用户每月提交代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> -

    <%# 用户最近六个月的提交次数 %> <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>

    -

    - <%# 用户最近一年的提交次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %> -

    <%# 用户最近六个月的代码量 %> <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>

    -

    - <%# 用户最近一年的代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_year")) %> -

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    <% html_title(l(:label_repository), l(:label_statistics)) -%> From e74ca78b0e25bf3b686a9a74a376b12971f2f233 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 27 Jul 2015 10:03:45 +0800 Subject: [PATCH 120/378] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB?= =?UTF-8?q?=E5=9C=A8debug=E7=8E=AF=E5=A2=83=E4=B8=8B=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=BAdebug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/environments/development.rb | 1 + db/schema.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index 2aca152cb..a3e7dff99 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,6 +7,7 @@ RedmineApp::Application.configure do # Log error messages when you accidentally call methods on nil. config.whiny_nils = true + config.log_level =:debug config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/db/schema.rb b/db/schema.rb index 912b4e8b4..9f9bbc33c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -737,6 +737,16 @@ ActiveRecord::Schema.define(:version => 20150722015428) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From b94f5a54cc7efe2b497f55a9f275f54a0c4ee09f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Jul 2015 10:43:39 +0800 Subject: [PATCH 121/378] =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E9=9B=86=E5=8F=AA=E8=A6=81=E8=80=81=E5=B8=88?= =?UTF-8?q?=E6=89=8D=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 2 +- .../_programing_work_show.html.erb | 67 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index c0f716ed7..6847da2c7 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -48,7 +48,7 @@
    - <% if homework.homework_type == 2 && homework.homework_detail_programing%> + <% if homework.homework_type == 2 && homework.homework_detail_programing && @is_teacher%> "> diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 7081dea8c..b259e20a5 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -24,42 +24,41 @@
    -
  • 测试结果: -
  • - - - - - - - <%@homework.homework_tests.each do |test|%> - "> - - - <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> - - - - <% end%> - <% student_work_test = @work.student_work_test.first%> - <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> - - + <% if @is_teacher%> +
  • 测试结果: +
  • 输入输出测试结果
    <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
    - <%= student_work_test.error_msg%> -
    + + + + + - <% end%> + <%@homework.homework_tests.each do |test|%> + "> + + + <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> + + + + <% end%> + <% student_work_test = @work.student_work_test.first%> + <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> + + + + <% end%> - -
    输入输出测试结果
    <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
    + <%= student_work_test.error_msg%> +
    -
    - - - <% if @is_teacher%> + + +
    +
    <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> From 81c942a7926ff79f021b6a0c5b80bf1adf9e242c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Jul 2015 15:06:00 +0800 Subject: [PATCH 122/378] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 38 --------------------------- app/views/welcome/course.html.erb | 13 +-------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9ce107f8b..6b14db9bb 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -100,44 +100,6 @@ class WelcomeController < ApplicationController @course_page = FirstPage.find_by_page_type('course') @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117 @logoLink ||= logolink() - - ##3-8月份为查找春季课程,9-2月份为查找秋季课程 - #month_now = Time.now.strftime("%m").to_i - #year_now = Time.new.strftime("%Y").to_i - #(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn) - ##year_now -= 1 if year_now < 3 - #@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) - ##未登录或者当前学校未开设课程 - #if @cur_school_course.empty? - # @has_course = false - # User.current.logged? ? course_count = 9 : course_count = 10 - # @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term) - # while @cur_school_course.count < 9 do - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term) - # end - #else - # if @cur_school_course.count < 9 - # @has_course = false - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term) - # if @cur_school_course.count < 9 - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term) - # end - # else - # @has_course = true - # end - #end end def logolink() diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 143c32dbe..4edec2202 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -56,21 +56,11 @@ <% end %> - - <%= l(:label_welcome_trustie_course) %> + <%= l(:label_welcome_trustie_course) %> <% else %> <% unless @course_page.nil? %> - <%= l(:label_welcome_trustie_course) %> , @@ -112,7 +102,6 @@ course_term = "春季学期" end %> - <%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> <% cur_school_course = @school_id.nil? ? [] : find_miracle_course(10,7,@school_id, year_now, course_term) %> <% if cur_school_course.count == 0 %> From 0d31536c6e065436b3810387ef402abd86577a8c Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 27 Jul 2015 15:21:31 +0800 Subject: [PATCH 123/378] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 + app/views/repositories/stats.html.erb | 49 ++++++++++++---------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 208a8bdb0..e0aea0c2e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -449,6 +449,8 @@ update def stats @project_id = params[:id] @repository_id = @repository.identifier + # 提交次数统计 + @status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id]) render :layout => 'base_projects' end diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index b5283629c..0bce15069 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -1,25 +1,30 @@

    <%= l(:label_statistics) %>

    -
    修订 是版本库的提交次数, 显示为橘红色。

    -
    变更 是对版本库中文件的修改次数, 显示为蓝色。
    -

    - <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> -

    -

    - <%# 用户每月提交代码次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> -

    -

    - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> -

    -

    - <%# 用户最近六个月的提交次数 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> -

    -

    - <%# 用户最近六个月的代码量 %> - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> -

    -

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    -<% html_title(l(:label_repository), l(:label_statistics)) -%> +<% if @status_commit_count ==0 %> +
    该项目目前还没有提交过代码!
    +<% else %> +
    修订 是版本库的提交次数, 显示为橘红色。

    +
    变更 是对版本库中文件的修改次数, 显示为蓝色。
    + +

    + <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> +

    +

    + <%# 用户每月提交代码次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> +

    +

    + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> +

    +

    + <%# 用户最近六个月的提交次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> +

    +

    + <%# 用户最近六个月的代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> +

    +

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    + <% html_title(l(:label_repository), l(:label_statistics)) -%> +<% end %> \ No newline at end of file From ed27b6e30f2672e57a9fdd3d8de93e2dbf79e49a Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 27 Jul 2015 16:03:03 +0800 Subject: [PATCH 124/378] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=99=BB=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 5ae9df001..a25aff6bb 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -388,7 +388,8 @@ class Mailer < ActionMailer::Base @user = applied.user recipients = @project.manager_recipients s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) - @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members') + @token = Token.get_token_from_user(@user, 'autologin') + @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value) mail :to => recipients, :subject => s end From 7c818ce59ac3cbfdcf6c6d996899c95796ad43db Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Jul 2015 16:07:29 +0800 Subject: [PATCH 125/378] =?UTF-8?q?admin=E7=95=8C=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AD=A6=E6=A0=A1=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E6=8C=89=E5=90=8D=E7=A7=B0=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 13 +++++++++ app/views/admin/schools.html.erb | 44 +++++++++++++++++++++++++++++ config/locales/zh.yml | 1 + config/routes.rb | 1 + lib/redmine.rb | 1 + public/stylesheets/courses.css | 1 - 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/schools.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 086ecfb7f..d2c94f5de 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -337,6 +337,19 @@ class AdminController < ApplicationController format.html end end + + #学校列表 + def schools + @q = params[:school_name] + if @q + @schools = School.where("name like '%#{@q}%'") + else + @schools = School.all + end + respond_to do |format| + format.html + end + end #移动端版本管理 def mobile_version @versions = PhoneAppVersion.reorder('created_at desc') diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb new file mode 100644 index 000000000..760a0c5a4 --- /dev/null +++ b/app/views/admin/schools.html.erb @@ -0,0 +1,44 @@ +

    + <%=l(:label_school_plural)%> +

    +<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> + <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> + +<% end %> +
    + +
    + + + + + + + + + + <% @schools.each do |school|%> + "> + + + + + <% end%> + +
    + LOGO + + 学校名称 +
    + <%= image_tag(school.logo_link,width:46,height:46) %> + + + <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %> + + + <%= link_to("上传logo", edit_organization_path(school.id), :class => 'icon icon-copy') %> + <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> +
    +
    + +<% html_title(l(:label_project_plural)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 83ccebbe9..1018a213a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -381,6 +381,7 @@ zh: label_organization_choose: --请选择组织-- label_organization_name: 组织名称 label_organization_list: 组织列表 + label_school_plural: 学校列表 label_organization_new: 新建组织 label_organization_edit: 修改组织 label_project_plural: 项目列表 diff --git a/config/routes.rb b/config/routes.rb index 1ae607eb7..d353c60ff 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -670,6 +670,7 @@ RedmineApp::Application.routes.draw do match 'admin/test_email', :via => :get match 'admin/default_configuration', :via => :post get 'admin/organization' + get 'admin/schools' resources :auth_sources do member do diff --git a/lib/redmine.rb b/lib/redmine.rb index 3043cfe5d..0f6c14b8a 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural + menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 778a474cd..00a2f0034 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -665,7 +665,6 @@ a:hover.ping_pic{border:1px solid #64bdd9;} .ping_back_tit{ float:left; width:523px; margin-left:10px; } a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;} a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} -.fr{ float:right;} .min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; } .li_min_search{ float:right; margin-right:-10px;} .info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;} From 19c515e11ed210611170cccd37bca61ac2a81e31 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Jul 2015 16:15:04 +0800 Subject: [PATCH 126/378] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/schools.html.erb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index 760a0c5a4..b5e649dd0 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -11,20 +11,26 @@ - + - + <% @schools.each do |school|%> "> + diff --git a/app/views/school/upload_logo.html.erb b/app/views/school/upload_logo.html.erb index 97a3f171c..26da7e081 100644 --- a/app/views/school/upload_logo.html.erb +++ b/app/views/school/upload_logo.html.erb @@ -1,5 +1,28 @@ -<%= form_tag({action: :upload},method: "post", multipart: true) do %> - <%= text_field_tag 'school'%> - <%= file_field_tag 'logo' %> - <%= submit_tag('Upload') %> + + +<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %> + <%#= text_field_tag 'school'%> +
    + + <%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%> + 上传图片 + <%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%> +
    +
    + <%= submit_tag('上传') %> + <%= submit_tag('取消') %> +
    +
    <% end %> + diff --git a/config/routes.rb b/config/routes.rb index d353c60ff..280053f60 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,17 @@ RedmineApp::Application.routes.draw do end + resources :school do + collection do + + end + + member do + get 'upload_logo' + post 'upload' + end + end + resources :homework_attach do collection do get 'get_homework_member_list' @@ -809,9 +820,6 @@ RedmineApp::Application.routes.draw do post 'school/search_school/', :to => 'school#search_school' get 'school/search_school/', :to => 'school#search_school' - post 'school/upload', :to => 'school#upload' - get 'school/upload_logo', :to => 'school#upload_logo' - ######added by nie match 'tags/show_projects_tags' ########### added by liuping diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d4d309181..3e01d68ff 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2796,4 +2796,15 @@ div.repos_explain{ .upload_img img{max-width: 100%;} #activity .upload_img img{max-width: 580px;} -img,embed{max-width: 100%;} \ No newline at end of file +img,embed{max-width: 100%;} + +img.school_avatar { + background: rgb(245, 245, 245); + padding: 4px; + border: 1px solid #e5dfc7; + float: left; + display: block; + width: 100px; + height: 100px; + max-width: none; +} \ No newline at end of file From 45d5972a93d98b576c57a8a78ed82a283949ccad Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 28 Jul 2015 10:27:45 +0800 Subject: [PATCH 130/378] =?UTF-8?q?=E5=9C=A8=E5=8F=91=E5=B8=83=E9=97=AE?= =?UTF-8?q?=E5=8D=B7=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=AD=E9=97=B4=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=8F=92=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 16 +- app/views/poll/_new_MC.html.erb | 1 + app/views/poll/_poll_form.html.erb | 186 ++++++++++++++++++++- app/views/poll/_show_MC.html.erb | 18 +- app/views/poll/_show_MCQ.html.erb | 14 +- app/views/poll/_show_mulit.html.erb | 14 +- app/views/poll/_show_single.html.erb | 14 +- app/views/poll/create_poll_question.js.erb | 6 +- public/stylesheets/polls.css | 5 +- 9 files changed, 261 insertions(+), 13 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 758747e02..8f81bc2c6 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -137,11 +137,19 @@ class PollController < ApplicationController @poll_questions.poll_answers.new question_option end end - if @poll_questions.save - respond_to do |format| - format.js + # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 + if params[:quest_id] + @is_insert = true + @poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1") + @poll_question_num = params[:quest_num].to_i + @poll_questions.question_number = params[:quest_num].to_i + 1 + end + if @poll_questions.save + respond_to do |format| + format.js + end end - end + end #修改题目 diff --git a/app/views/poll/_new_MC.html.erb b/app/views/poll/_new_MC.html.erb index 8c47baa01..e5f2a6b82 100644 --- a/app/views/poll/_new_MC.html.erb +++ b/app/views/poll/_new_MC.html.erb @@ -1,5 +1,6 @@ <%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%> + <% insert_begin = insert_begin %>
    diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 74ca9fb32..0a15143fb 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -6,23 +6,203 @@ function edit_head(){ $("#polls_description").val($("#polls_description_div").html()); } - function add_MC(){ +function chooseQuestionType(quest_type,quest_id){ + $("#div_"+quest_type+"_"+quest_id).css("position", "absolute"); + + $("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30); + + $("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10); + if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') { + $("#div_"+quest_type+"_"+quest_id).css('display', 'none'); + } + else{ + $("#div_"+quest_type+"_"+quest_id).css('display', 'block'); + } +} + +function add_MC(){ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>"); $("#poll_questions_title").focus(); - } - function add_MCQ(){ +} + + function insert_MC(quest_type,quest_num,quest_id){ + $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( + '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ + '
    '+ + '
    '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
    '+ + '
    '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    '+ + '
    '+ + ''+ + '
    '+ + '
    '+ + '<% end%>' + ); + $("#poll_questions_title").focus(); +} + +function add_MCQ(){ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>"); $("#poll_questions_title").focus(); +} + +function insert_MCQ(quest_type,quest_num,quest_id){ + $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( + '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ + '
    '+ + '
    '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
    '+ + '
    '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    • '+ + ''+ + ''+ + ''+ + ''+ + '
    • '+ + '
      '+ + '
    '+ + '
    '+ + ''+ + '
    '+ + '
    '+ + '<% end%>' + ); + $("#poll_questions_title").focus(); } + function add_single(){ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>"); $("#poll_questions_title").focus(); } + + function insert_SINGLE(quest_type,quest_num,quest_id){ + $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( + '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ + '
    '+ + '
    '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
    '+ + ''+ + '
    '+ + '
    '+ + '<% end%>' + ); + $("#poll_questions_title").focus(); + } function add_mulit(){ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>"); $("#poll_questions_title").focus(); } + function insert_MULIT(quest_type,quest_num,quest_id){ + $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( + '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ + '
    '+ + '
    '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
    '+ + '
    '+ + '
    '+ + ''+ + '
    '+ + '
    '+ + '<% end%>' + ); + $("#poll_questions_title").focus(); + } + //添加标题时确定按钮 function add_poll_question(doc) { diff --git a/app/views/poll/_show_MC.html.erb b/app/views/poll/_show_MC.html.erb index ff8e52f25..9c47894dc 100644 --- a/app/views/poll/_show_MC.html.erb +++ b/app/views/poll/_show_MC.html.erb @@ -1,3 +1,6 @@ +
    @@ -9,9 +12,11 @@ * <%end%>
    + <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
    + + 序号 + LOGO 学校名称
    + <%= school.id %> + - <%= image_tag(school.logo_link,width:46,height:46) %> + <%= image_tag(school.logo_link,width:40,height:40) %> From 9beb8acb991ad24d34e686d92fa9f70202d2c03d Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 27 Jul 2015 16:49:21 +0800 Subject: [PATCH 127/378] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=9A1=E3=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=87=A0=E6=9D=A1=E8=AE=B0=E5=BD=95=E5=90=8E=E4=B8=8D=E6=BB=A1?= =?UTF-8?q?=E5=8D=81=E6=9D=A1=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=202=E3=80=81=E6=96=87=E6=A1=A3=E8=AE=B0=E5=BD=95=E4=B8=8D?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=98=BE=E7=A4=BA=E5=9C=A8=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2efaf591a..d578fe586 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -280,11 +280,11 @@ class ProjectsController < ApplicationController # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - @events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20); + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20); #events = @activity.events(@date_from, @date_to) else @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public - = ?",@project,1).order("created_at desc") + = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") .page(params['page'|| 1]).per(10); # @events = @activity.events(@date_from, @date_to, :is_public => 1) end From 0f82bbf79739794b1ce160c06e00e875b7b0199c Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 27 Jul 2015 18:15:05 +0800 Subject: [PATCH 128/378] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8C=BF=E5=90=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 18 +++++++++++++----- app/views/projects/show.html.erb | 14 -------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d578fe586..09ae5ad79 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -150,11 +150,15 @@ class ProjectsController < ApplicationController end def new - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @project = Project.new - @project.safe_attributes = params[:project] - render :layout => 'base' + if User.current.login? + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @project = Project.new + @project.safe_attributes = params[:project] + render :layout => 'base' + else + redirect_to signin_url + end end def share @@ -167,6 +171,10 @@ class ProjectsController < ApplicationController end def create + unless User.current.login? + redirect_to signin_url + return + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index ca7bb6159..f1b3d9b7b 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -93,21 +93,7 @@
    - - <% elsif e.forge_act_type == "Document" %> -
    - <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
    - - <%= h(e.project) if @project.nil? || @project.id != e.project_id %> - <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : - <%= link_to format_activity_title("#{l(:label_document)}: #{act.title}"), {:controller => 'documents', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %>
    -

    <%= textAreailizable act,:description %>
    - <%= l :label_create_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

    -
    -
    -
    <% elsif e.forge_act_type == "Attachment" %>
    From 6091369e02b33042749218e39a401eace43da23c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Jul 2015 18:20:20 +0800 Subject: [PATCH 129/378] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=A6=E6=A0=A1log?= =?UTF-8?q?o=E7=9A=84=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=AE=9E=E6=97=B6=E9=A2=84=E8=A7=88=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 +++--- app/controllers/school_controller.rb | 17 +++++---------- app/views/admin/schools.html.erb | 4 ++-- app/views/school/upload_logo.html.erb | 31 +++++++++++++++++++++++---- config/routes.rb | 14 +++++++++--- public/stylesheets/application.css | 13 ++++++++++- 6 files changed, 60 insertions(+), 25 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d2c94f5de..a44b58789 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -340,9 +340,9 @@ class AdminController < ApplicationController #学校列表 def schools - @q = params[:school_name] - if @q - @schools = School.where("name like '%#{@q}%'") + @school_name = params[:school_name] + if @school_name + @schools = School.where("name like '%#{@school_name}%'") else @schools = School.all end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 008fe00fc..3e0c280ac 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -4,28 +4,21 @@ class SchoolController < ApplicationController def upload uploaded_io = params[:logo] - school_id = 0 - schools = School.where("name = ?", params[:school]) - - schools.each do |s| - school_id = s.id - end - + school_id ||= params[:id] unless uploaded_io.nil? File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file| file.write(uploaded_io.read) end - s1 = School.find(school_id) s1.logo_link = '/images/school/'+school_id.to_s+'.png' s1.save - - - end + end + redirect_to admin_schools_url(:school_name => params[:school_name]) end def upload_logo - + @school = School.find params[:id] + @school_name = params[:school_name] end #获取制定学校开设的课程数 diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index b5e649dd0..0956981e8 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -3,7 +3,7 @@ <%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> - + <% end %>
    @@ -38,7 +38,7 @@
    - <%= link_to("上传logo", edit_organization_path(school.id), :class => 'icon icon-copy') %> + <%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %> <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
    @@ -29,4 +34,15 @@
    -
    \ No newline at end of file +
    + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/_show_MCQ.html.erb b/app/views/poll/_show_MCQ.html.erb index 63b9d1c1f..fb2c03080 100644 --- a/app/views/poll/_show_MCQ.html.erb +++ b/app/views/poll/_show_MCQ.html.erb @@ -12,6 +12,7 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
    @@ -29,4 +30,15 @@
    -
    \ No newline at end of file +
    + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/_show_mulit.html.erb b/app/views/poll/_show_mulit.html.erb index 2d52fffb5..ad01d0a3e 100644 --- a/app/views/poll/_show_mulit.html.erb +++ b/app/views/poll/_show_mulit.html.erb @@ -13,9 +13,21 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
    - \ No newline at end of file + + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 8caa7b1a5..f5846b6b7 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -12,8 +12,20 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
    - \ No newline at end of file + + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/create_poll_question.js.erb b/app/views/poll/create_poll_question.js.erb index ac44ebb4c..8a597514e 100644 --- a/app/views/poll/create_poll_question.js.erb +++ b/app/views/poll/create_poll_question.js.erb @@ -1,4 +1,8 @@ +<% if @is_insert %> + $("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>'); +<% else %> $("#new_poll_question").html(""); + $("#poll_content").append("
    " + "
    " + "<% if @poll_questions.question_type == 1%>" + @@ -23,4 +27,4 @@ $("#poll_content").append("
    " + "<% end%>" + "
    " + "
    "); - +<% end %> diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 353ec3937..83fa5089b 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -28,7 +28,7 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} #polls div{word-break: break-all;word-wrap: break-word;} .ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; } .ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;} -.ur_title{ padding:20px 0px ; float:left; width:604px; } +.ur_title{ padding:20px 0px ; float:left; width:564px; } .ur_required{ font-weight: bold; color:red;} .ur_inputs{ color:#666;} .ur_table{border-top:1px solid #dcdcdc; background:#fff;} @@ -101,10 +101,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;} .ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;} a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; } a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;} + a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;} a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;} .ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;} +.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} +a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;} /***弹框***/ .popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} From 6b45702f8c403a7f5b37393ae26b9cb8cbf664d0 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 28 Jul 2015 11:20:21 +0800 Subject: [PATCH 131/378] =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=A4=84=E5=8F=AF=E4=BB=A5=E8=AE=A9=E5=BC=B9=E5=87=BA=E6=A1=86?= =?UTF-8?q?=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll_form.html.erb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 0a15143fb..b081f4d18 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -2,11 +2,24 @@ - diff --git a/public/javascripts/user.js b/public/javascripts/user.js new file mode 100644 index 000000000..7c7189066 --- /dev/null +++ b/public/javascripts/user.js @@ -0,0 +1,238 @@ +$(function(){ + if($(".top_new").length==0){ + $("#RSide").css("min-height",$("#LSide").height()-30); + } + else{ + $("#RSide").css("min-height",$("#LSide").height()-87); + } + +}); + +//个人动态 +$(function(){ + + function init_editor(params){ + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", + items:['emoticons'], + afterChange:function(){//按键事件 + nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + }, + afterCreate:function(){ + var toolbar = $("div[class='ke-toolbar']",params.div_form); + $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); + params.toolbar_container.append(toolbar); + } + }).loadPlugin('paste'); + return editor; + } + + function nh_check_field(params){ + var result=true; + if(params.content!=undefined){ + if(params.content.isEmpty()){ + result=false; + } + if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + params.textarea.html(params.content.html()); + params.content.sync(); + if(params.content.isEmpty()){ + params.contentmsg.html('内容不能为空'); + params.contentmsg.css({color:'#ff0000'}); + }else{ + params.contentmsg.html('填写正确'); + params.contentmsg.css({color:'#008000'}); + } + params.contentmsg.show(); + } + } + return result; + } + function init_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = nh_check_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + }); + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); + } + function nh_reset_form(params){ + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); + } + + KindEditor.ready(function(K){ + $("a[nhname='reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent('div'); + params.div_form = $("div[nhname='div_form']",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form); + params.submit_btn = $("a[nhname='submit_btn']",params.div_form); + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + toggleAndSettingWordsVal(params.div_form, params.textarea); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + } + params.cancel_btn.click(); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + + }); + + $("div[nhname='new_message']").each(function(){ + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form",params.div_form); + if(params.form==undefined || params.form.length==0){ + return; + } + params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); + params.submit_btn = $("#new_message_submit_btn"); + + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + $(this).show(); + } + }); + }); +}); +function init_list_more_div(params){ + var p=params; + p.exbtn.click(function(){ + var isclose = p.container.data('isclose'); + var hasmore = p.container.data('hasmore'); + if(isclose == '1'){ + $("div[nhname='rec']",p.container).show(); + p.container.data('isclose','0'); + change_status_4_list_more_div(params); + return; + } + if(hasmore == '0'){ + change_status_4_list_more_div(params,'get'); + return; + } + var url = p.container.data('url'); + if($("div[nhname='rec']",p.container).length > 0){ + var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id'); + url += "?lastid="+lastid; + var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time'); + if(lasttime != undefined){ + url += "&lasttime="+lasttime; + } + } + $.ajax( {url:url,dataType:'text',success:function(data){ + var html = $("
    "+data+"
    "); + var lens = $("div[nhname='rec']",html).length; + if(lens < p.size){ + p.container.data('hasmore','0'); + } + if(lens>0){ + var currpage = parseInt(p.container.data('currpage'))+1; + p.container.data('currpage',currpage); + p.container.append(html.html()) + } + change_status_4_list_more_div(params,'get'); + p.div.show(); + }} ); + }); + p.clbtn.click(function(){ + var i=0; + $("div[nhname='rec']",p.container).each(function(){ + i++; + if(i> p.size){ + $(this).hide(); + } + }); + p.container.data('isclose','1'); + change_status_4_list_more_div(params); + }); + p.exbtn.click(); +} +function change_status_4_list_more_div(params,opt){ + var p=params; + if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){ + p.exbtn.click(); + return; + } + var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length; + if( show_lens > p.size ){ + p.clbtn.show(); + }else{ + p.clbtn.hide(); + } + if($("div[nhname='rec']",p.container).length == 0){ + p.exbtn.html(p.nodatamsg); + }else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){ + p.exbtn.html('点击展开更多'); + }else{ + p.exbtn.html('没有更多了'); + } +} +function init_list_more_div_params(div){ + var params = {}; + params.div = div; + params.container = $("div[nhname='container']",div); + params.exbtn = $("a[nhname='expand']",div); + params.clbtn = $("a[nhname='close']",div); + params.size = params.container.data('pagesize'); + params.nodatamsg = params.container.data('nodatamsg'); + if( params.size == undefined ){ + params.size = 13; + } + return params; +} +$(function(){ + $("div[nhname='list_more_div']").each(function(){ + var params = init_list_more_div_params($(this)); + init_list_more_div(params) + }); +}); +//个人动态 end \ No newline at end of file diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css index 30e6594f5..7c3dad383 100644 --- a/public/stylesheets/users.css +++ b/public/stylesheets/users.css @@ -8,7 +8,7 @@ .icon_female{ background:url(../images/pic_uersall.png) 0 -24px no-repeat; width:15px; height:15px;} .pf_intro{ width:222px; margin-top:5px; color:#696969;word-break: break-all; } .leftbox{ width:230px; padding:10px; padding-right:0px; padding-bottom:5px;background:#fff; margin-bottom:10px; margin-right:10px;} -.pic_members{ background:url(../images/pic_users.jpg) 0 0 no-repeat; display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} +.pic_members{ display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} .pic_members:hover{border:1px solid #c9c9c9;} /*新建*/ .top_new{ height:26px; border-bottom:10px solid #eaebed; padding:10px; background:#fff; float:left; margin-left:10px; width:730px; } @@ -89,7 +89,7 @@ a.select_btn_select{ background:#64bddb; color:#fff;} .users_ctt input,.users_ctt select,.users_ctt textarea{ border:1px solid #CCC;} .users_ctt input,.users_ctt select,.users_ctt option{ height:26px;} .users_ctt input,.users_ctt textarea{ margin-left:2px;} -.users_ctt textarea{ margin-bottom:none;} +/*.users_ctt textarea{ margin-bottom:nor;}*/ .w450{ width:450px;} .w210{ width:200px;} .w70{ width:70px;} @@ -124,4 +124,12 @@ a:hover.c_lgrey{ color:#3ca5c6;} .newhwork_div textarea{border:1px solid #CCC;} .w460{ width:460px;} -a.hidepic>img{display:none;} \ No newline at end of file +a.hidepic>img{display:none;} + +div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} +span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} +span.ke-toolbar-icon-url{background-image:url( ../images/public_icon.png )} +div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} +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;} \ No newline at end of file From 6a9cb0db5d51ca5c996f13849a1d94291267b867 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 28 Jul 2015 17:17:52 +0800 Subject: [PATCH 142/378] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E7=94=A8=E6=88=B7=E8=87=AA=E5=B7=B1=E6=9C=AC?= =?UTF-8?q?=E8=BA=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachments/_project_file_links.html.erb | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index b6d934c64..b644fb9fa 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -29,32 +29,32 @@ <% is_float ||= false %> <% for attachment in attachments %>
    -

    - <%if is_float%> -

    - <% end%> - +

    + <%if is_float%> +

    + <% end%> + <% if options[:length] %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> <% else %> - <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%> + <% end %> - <%if is_float%> -
    - <% end%> + <%if is_float%> +
    + <% end%> - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :filename => attachment.filename%> - <% end %> + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename%> + <% end %>
    - <%= h(" - #{attachment.description}") unless attachment.description.blank? %> -
    + <%= h(" - #{attachment.description}") unless attachment.description.blank? %> +
    ( <%= number_to_human_size attachment.filesize %>) @@ -66,6 +66,16 @@ :class => 'delete delete-homework-icon', :remote => true, :title => l(:button_delete) %> + <% elsif attachment.container_type == 'Issue' %> + <% if User.current == attachment.author %> + <%= link_to image_tag('delete.png'), attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete', + #:remote => true, + #:id => "attachments_" + attachment.id.to_s, + :title => l(:button_delete) %> + <% end %> <% else %> <%= link_to image_tag('delete.png'), attachment_path(attachment), :data => {:confirm => l(:text_are_you_sure)}, @@ -89,13 +99,13 @@

    <% end %>
    - <% if defined?(thumbnails) && thumbnails %> - <% images = attachments.select(&:thumbnailable?) %> - <% if images.any? %> + <% if defined?(thumbnails) && thumbnails %> + <% images = attachments.select(&:thumbnailable?) %> + <% if images.any? %> <% images.each do |attachment| %>
    <%= thumbnail_issue_tag(attachment) %>
    <% end %> - <% end %> - <% end %> + <% end %> + <% end %>
    From a0a5f3410847752d2c28c535a801976558046546 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 29 Jul 2015 10:07:00 +0800 Subject: [PATCH 143/378] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BB=A5=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 31 +++++++++++++++++++++ app/views/poll/_poll_form.html.erb | 43 +++++++++++++++++++++++++++++- app/views/poll/_show_head.html.erb | 3 +++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 8f81bc2c6..dda5b81b2 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -336,6 +336,37 @@ class PollController < ApplicationController end end + + def import_poll + @poll = Poll.find(params[:to_id]) + question_num = @poll.poll_questions.select("max(question_number) question_number").first.question_number + import_poll = Poll.find(params[:import_id]) + import_poll.poll_questions.each_with_index do |question,index| + option = { + :is_necessary => question.is_necessary, + :question_title => question.question_title, + :question_type => question.question_type, + :question_number => question_num + index+1 + } + poll_questions = @poll.poll_questions.new option + for i in 1..question.poll_answers.count + answer = question.poll_answers[i-1][:answer_text] + question_option = { + :answer_position => i, + :answer_text => answer + } + poll_questions.poll_answers.new question_option + end + @poll.poll_questions << poll_questions + end + if @poll.save + @poll = Poll.find(params[:to_id]) + respond_to do |format| + format.js + end + end + end + #重新发布问卷 def republish_poll @poll.poll_questions.each do |poll_question| diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index d784edab3..c5c016583 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -3,6 +3,7 @@ diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 98c148372..c7a615ba3 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -491,3 +491,8 @@ function judgeprojectname(){ } }); } + +//用户反馈 +function submitProjectFeedback() { + $("#project_feedback_form").submit(); +} \ No newline at end of file From e4e99df1135f721da79932e481098af835b687d8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 29 Jul 2015 17:41:10 +0800 Subject: [PATCH 150/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=95=99=E8=A8=80=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E7=95=99=E8=A8=80=E7=9A=84=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_jours_new.html.erb | 53 +++++++++++++ app/views/users/user_newfeedback.html.erb | 91 +++++------------------ app/views/words/destroy.js.erb | 7 +- public/javascripts/user.js | 1 - public/stylesheets/public.css | 1 + public/stylesheets/users.css | 17 +++-- 6 files changed, 86 insertions(+), 84 deletions(-) create mode 100644 app/views/users/_user_jours_new.html.erb diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb new file mode 100644 index 000000000..81bbce319 --- /dev/null +++ b/app/views/users/_user_jours_new.html.erb @@ -0,0 +1,53 @@ +
    +
    + <%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %> +
    +
    + <%= link_to "#{jour.user.login} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%> +
    +
    +
    + <%= jour.notes.html_safe %> +
    +
    + + <%= time_tag(jour.created_on).html_safe %> + +
    + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || jour.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %> + <% end %> +
    +
    +
    + + <% fetch_user_leaveWord_reply(jour).each do |reply|%> +
    + <% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +
    + <%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %> +
    + <%= link_to "#{reply.user.login} : ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> +  回复:  + <%= link_to "#{parent_jour.user.login} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%> +
    + <%= reply.notes.html_safe %> +
    +
    + + <%= time_tag(reply.created_on).html_safe%> + +
    + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || reply.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %> + <% end %> +
    +
    +
    +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index de0bfbd60..52fc0aaa2 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,82 +1,27 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>

    用户留言

    - - 表情 - 取消 - 发布 +
    + + +

    +
    + 取消 + 留言 + +
    -
    -
    - 头像 -
    - 黄井泉 :  -

    上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。回复删除

    -
    - 50分钟前 -
    -
    - - 表情 - 取消 - 发布 -
    -
    -
    - 头像 -
    - 尹刚尹刚尹刚 -  回复:  - 黄井泉 -

    非常好!删除

    -
    - 30分钟前 -
    -
    -
    -
    - 头像 -
    - 白羽 :  -

    什么时候放暑假啊?回复删除

    -
    - 50分钟前 -
    -
    -
    - 头像 -
    - 黄井泉 :  -

    上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。上周交代的bug修改完成。回复删除

    -
    - 50分钟前 -
    -
    - 头像 -
    - 尹刚尹刚尹刚 -  回复:  - 黄井泉 -

    非常好!删除

    -
    - 30分钟前 -
    -
    -
    -
    - 头像 -
    - 白羽 :  -

    什么时候放暑假啊?回复删除

    -
    - 50分钟前 -
    -
    - - -
    +
    + <%if @jour%> + <% @jour.each do |jour|%> + <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <%end%> + <% end%> +
    +
    \ No newline at end of file diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 92e15ab93..c138a7ea7 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,9 +2,10 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - $("#nh_jours_<%= @journal_destroyed.id %>",$("div[nhname='container']",$("#nh_messages"))).remove(); - var params = init_list_more_div_params($("#nh_messages")); - change_status_4_list_more_div(params); + var destroyedItem = $('#<%=@journal_destroyed.id%>'); + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); diff --git a/public/javascripts/user.js b/public/javascripts/user.js index 7c7189066..9ad3d1588 100644 --- a/public/javascripts/user.js +++ b/public/javascripts/user.js @@ -10,7 +10,6 @@ $(function(){ //个人动态 $(function(){ - function init_editor(params){ var editor = params.kindutil.create(params.textarea, { resizeType : 1,minWidth:"1px",width:"100%",height:"80px", diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d0893ca3d..c1e47c787 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -87,6 +87,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mt10{ margin-top:10px;} .mt30{ margin-top: 30px;} .mb5{ margin-bottom:5px;} +.mb8{ margin-bottom:8px;} .mb10{ margin-bottom:10px;} .mb20{ margin-bottom:20px;} .pl15{ padding-left:15px;} diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css index 3e17f1f7b..bdc6db47c 100644 --- a/public/stylesheets/users.css +++ b/public/stylesheets/users.css @@ -24,12 +24,14 @@ a.icon_face{background:url(../images/public_icon.png) 0px -671px no-repeat; dis a:hover.icon_face{background:url(../images/public_icon.png) -79px -671px no-repeat; } .inputUsers_message{ border:1px solid #d2d2d2; width:718px; height:48px; color:#666; padding:5px; margin-bottom:5px;} .inputUsers_message02{ border:1px solid #d2d2d2; width:618px; height:26px; color:#666; padding:5px; margin-bottom:5px; } -.message_list_box{ background:#f5f5f5; padding:10px;} -.users_pic{ width:27px; height:27px; border:1px solid #e3e3e3;} +.message_list_box{ background:#f5f5f5; padding:10px;margin-top: 10px;} +.users_pic{ width:46px; height:46px; border:1px solid #e3e3e3;} .users_pic:hover{ border:1px solid #a5a5a5;} +.users_pic_sub{width:32px; height:32px; border:1px solid #e3e3e3;} +.users_pic_sub:hover{ border:1px solid #a5a5a5;} .massage_txt{ max-width:360px; color: #666;word-break:break-all;} .massage_time{ color:#8d8d8d; margin-top:5px;} -.message_list{ border-bottom:1px dashed #c9c9c9; padding-bottom:10px; margin-bottom:10px;} +.message_list{ border-bottom:1px dashed #c9c9c9; margin-bottom:10px;color: #5f5f5f;} .message_list_more{ text-align:center; width:720px;} /*课程动态*/ .line_box{ width:728px; border:1px solid #d9d9d9; padding-bottom:10px;} @@ -124,9 +126,9 @@ a:hover.c_lgrey{ color:#3ca5c6;} .newhwork_div textarea{border:1px solid #CCC;} .w460{ width:460px;} /* 留言新增*/ -.mes_box{ width:600px;} -.mes_box02{ margin-left:80px; border-top:1px dashed #c9c9c9; padding-top:10px;} -.mes_box02_info{ width:500px; margin-left:5px;} +.mes_box{ width:590px;} +.mes_box02{ margin-left:50px; border-top:1px dashed #c9c9c9; padding-top:10px;margin-bottom: 10px;} +.mes_box02_info{ width:540px; margin-left:5px;} .users_r_top{ width:730px; height:40px; background:#eaeaea; margin-bottom:10px;} .users_r_h2{background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} @@ -139,4 +141,5 @@ span.ke-toolbar-icon-url{background-image:url( ../images/public_icon.png )} div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} 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;} \ No newline at end of file +div.ke-toolbar .ke-outline{border:none;} +.cr{clear: right;} \ No newline at end of file From 9bcc633d19c34f0497c64f5467bcdef4d0995388 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 29 Jul 2015 17:56:40 +0800 Subject: [PATCH 151/378] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=B7=BB=E5=8A=A0tag?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=BC=BA=E9=99=B7=201=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0ajax=E8=87=AA=E8=BA=AB=E5=88=B7=E6=96=B0=202=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/tags/_project_tag.html.erb | 17 +++-------- app/views/tags/_tag_project_new_name.html.erb | 30 +++++++++++++++++++ app/views/tags/remove_tag.js.erb | 3 ++ app/views/tags/tag_save.js.erb | 4 +++ 4 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 app/views/tags/_tag_project_new_name.html.erb diff --git a/app/views/tags/_project_tag.html.erb b/app/views/tags/_project_tag.html.erb index ce80e36ab..408f3ba1d 100644 --- a/app/views/tags/_project_tag.html.erb +++ b/app/views/tags/_project_tag.html.erb @@ -1,15 +1,6 @@ -
    - <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    +
    + <%= render :partial => "tags/tag_project_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    -<% if User.current.logged?%> - <%= l(:label_add_tag)%> - -<% end%> diff --git a/app/views/tags/_tag_project_new_name.html.erb b/app/views/tags/_tag_project_new_name.html.erb new file mode 100644 index 000000000..e657071bc --- /dev/null +++ b/app/views/tags/_tag_project_new_name.html.erb @@ -0,0 +1,30 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% if @tags.size > 0 %> + <% @tags.each do |tag| %> + + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> + + diff --git a/app/views/tags/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index b8c65c13e..cd56fef1a 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -2,6 +2,9 @@ <% if @object_flag == '3'%> $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% elsif @object_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); <% elsif @object_flag == '6'%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 74a38c99d..992c472ed 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -4,6 +4,10 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); //$('#put-tag-form-issue').hide(); $('#name-issue').val(""); +<% elsif @obj_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name2').val(""); <% elsif @obj_flag == '6'%> <%if @course%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); From d790fb31e497198d906dab090a59eb2a797dfdae Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 29 Jul 2015 18:00:35 +0800 Subject: [PATCH 152/378] =?UTF-8?q?=E5=8C=BF=E5=90=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E5=9C=A8=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 161791954..4b99224ca 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -4,7 +4,7 @@ class WordsController < ApplicationController include ApplicationHelper before_filter :find_user, :only => [:new, :create, :destroy, :more, :back] def create - if params[:new_form][:user_message].size>0 + if params[:new_form][:user_message].size>0 && User.current.logged? unless params[:user_id].nil? if params[:reference_content] message = params[:new_form][:user_message] + "\n" + params[:reference_content] @@ -31,9 +31,7 @@ class WordsController < ApplicationController # @jour = paginateHelper @jours,10 respond_to do |format| - # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} format.js - #format.api { render_api_ok } end end From ce89c7d1191dcc79b8ef6f49fa7af60b8c40f8f6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 29 Jul 2015 18:26:04 +0800 Subject: [PATCH 153/378] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=90=8E=E7=95=8C=E9=9D=A2=E7=9A=84=E5=88=B7=E6=96=B0=EF=BC=8C?= =?UTF-8?q?=E7=95=99=E8=A8=80=E7=9A=84=E5=88=86=E9=A1=B5=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 20 ++++++++++---------- app/views/users/_user_jours_new.html.erb | 1 + app/views/users/user_newfeedback.html.erb | 21 +++++++++++++-------- config/routes.rb | 1 + 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 4b99224ca..fc723d5d5 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -18,17 +18,10 @@ class WordsController < ApplicationController list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id) end @jour = list.last - # @user.count_new_jour - # if a_message.size > 5 - # @message = a_message[-5, 5] - # else - # @message = a_message - # end - # @message_count = a_message.count end end - # @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse - # @jour = paginateHelper @jours,10 + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour = paginateHelper jours,10 respond_to do |format| format.js @@ -91,7 +84,6 @@ class WordsController < ApplicationController end respond_to do |format| format.js - #format.api { render_api_ok } end end @@ -204,7 +196,15 @@ class WordsController < ApplicationController flash[:error] = feedback.errors.full_messages[0] redirect_to project_feedback_url(params[:id]) end + end + #给用户留言 + def leave_user_message + @user = User.find(params[:id]) + if params[:new_form][:user_message].size>0 && User.current.logged? && @user + @user.add_jour(User.current, params[:new_form][:user_message]) + end + redirect_to feedback_path(@user) end # add by nwb diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb index 81bbce319..7aa9d97ff 100644 --- a/app/views/users/_user_jours_new.html.erb +++ b/app/views/users/_user_jours_new.html.erb @@ -15,6 +15,7 @@
    <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || jour.user == User.current%> <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %> diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 52fc0aaa2..d594e47e4 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -5,22 +5,27 @@
    -
    - -

    -
    - 取消 - 留言 -
    + <%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%> + +

    +
    + 取消 + 留言 + <% end%>
    -
    +
    <%if @jour%> <% @jour.each do |jour|%> <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> <%end%> <% end%> + +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    diff --git a/config/routes.rb b/config/routes.rb index 7c1096303..1536340da 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -791,6 +791,7 @@ RedmineApp::Application.routes.draw do match 'words/:id/leave_project_message', :to => 'words#leave_project_message' match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share + post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' From 206d1a38f7484d50a0273da56001902643679948 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 30 Jul 2015 09:07:11 +0800 Subject: [PATCH 154/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=BC=BA=E9=99=B7=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/project.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index fa1bec754..621e0c556 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -74,7 +74,11 @@ a:hover.problem_pic{border:1px solid #64bdd9;} .issues_icon{ background:url(../images/public_icon.png) 0 -342px no-repeat; width:16px; height:21px;} .problem_txt{ width:600px; margin-left:10px; color:#777777; } .pro_txt_w{width:610px;} -a.problem_name{ color:#ff5722; } +a.problem_name{ color:#ff5722;max-width: 80px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} a:hover.problem_name{ color:#d33503;} a.problem_tit{ color:#0781b4; max-width:430px; font-weight:bold; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a.problem_tit02{ color:#0781b4; font-weight:bold;max-width:400px;} From 023f51260a2cee67fa1e4bc83e7f5fe74d4d7eb1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 30 Jul 2015 09:12:43 +0800 Subject: [PATCH 155/378] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=95=8C=E9=9D=A2js=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=97=B6=E5=80=99=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users_new.html.erb | 3 +++ public/stylesheets/users.css | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index ec2c18602..70106e4a3 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -269,6 +269,9 @@ <%= render :partial => 'layouts/new_feedback' %> + <% html_title(l(:label_leave_message_list)) -%> diff --git a/app/views/admin/messages_list.html.erb b/app/views/admin/messages_list.html.erb index 77cdbbc69..e0c84279d 100644 --- a/app/views/admin/messages_list.html.erb +++ b/app/views/admin/messages_list.html.erb @@ -29,7 +29,7 @@ - <% @count=0%> + <% @count=@page * 30%> <% for memo in @memo -%> <% @count=@count + 1 %> "> @@ -50,20 +50,18 @@ <%= format_date(memo.created_at) %> - <%= memo.subject %> + <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> - <%=memo.replies_count %> + <%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %> <% end %>
    - + <% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/notices.html.erb b/app/views/admin/notices.html.erb index 56f212720..f03a7b97a 100644 --- a/app/views/admin/notices.html.erb +++ b/app/views/admin/notices.html.erb @@ -33,7 +33,7 @@ - <% @count=0%> + <% @count=@page * 30%> <% for news in @news -%> <% @count=@count + 1 %> "> @@ -63,7 +63,7 @@ <%= link_to(news.title, news_path(news)) %> - <%=news.comments_count %> + <%= link_to(news.comments_count, news_path(news)) %> <% end %> @@ -71,4 +71,8 @@
    + + <% html_title(l(:label_notification_list)) -%> diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb index af2978422..dc44a7cba 100644 --- a/app/views/admin/project_messages.html.erb +++ b/app/views/admin/project_messages.html.erb @@ -29,7 +29,7 @@ - <% @count=0%> + <% @count=@page * 30 %> <% for project in @project_ms -%> <% @count=@count + 1 %> @@ -51,10 +51,10 @@ <%= format_date(project.created_on) %> - <%= project.subject %> + <%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %> - <%=project.replies_count %> + <%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %> @@ -63,4 +63,8 @@ + + <% html_title(l(:label_message_plural)) -%> diff --git a/db/schema.rb b/db/schema.rb index 8d78a9ca0..841bcc7e9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -474,13 +474,6 @@ ActiveRecord::Schema.define(:version => 20150815030833) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -893,6 +886,7 @@ ActiveRecord::Schema.define(:version => 20150815030833) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" From 3e4f726855de4448c0fa8e6d7f2a2984d81a785c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 18 Aug 2015 14:43:15 +0800 Subject: [PATCH 307/378] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=95=99=E8=A8=80?= =?UTF-8?q?=E3=80=81=E6=8C=87=E6=B4=BE=E7=BB=99=E6=88=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 +++ app/views/users/user_messages.html.erb | 34 +++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 770d7d049..dbcbdefa6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -126,6 +126,9 @@ class UsersController < ApplicationController when 'issue' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") @user_course_messages = nil + when 'journal' + @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + @user_course_messages = nil end respond_to do |format| format.html{render :layout=>'base_users_new'} diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 2e7b110bf..c23ad3716 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -14,6 +14,7 @@
  • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
  • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
  • +
  • <%= link_to "问题更新",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'journal'} %>
  • @@ -76,9 +77,36 @@ <% unless @user_forge_messages.nil? %> <% @user_forge_messages.each do |ufm| %> - <% if ufm.forge_message_type == "Issue" %> - 22222 - <% end %> + <% if ufm.forge_message_type == "Issue" %> + + <% end %> + <% if ufm.forge_message_type == "Journal" %> + + <% end %> <% end %> <% end %> <% else %> From 9c4e89177f68967aa0537dc390737c6ea6ad463a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 18 Aug 2015 14:44:46 +0800 Subject: [PATCH 308/378] =?UTF-8?q?=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index c23ad3716..77b7d5898 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -14,7 +14,7 @@
  • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
  • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
  • -
  • <%= link_to "问题更新",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'journal'} %>
  • +
  • <%= link_to "我的留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'journal'} %>
  • From 7219586b1e1cfb34b258052f6ab7ecaf3bfda01e Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 15:25:36 +0800 Subject: [PATCH 309/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 37 ++++++++++++++--- .../users/_resource_search_form.html.erb | 7 ++++ app/views/users/_resources_list.html.erb | 2 +- app/views/users/rename_resource.js.erb | 1 + app/views/users/resource_preview.js.erb | 2 + app/views/users/user_resource.html.erb | 41 ++++++++++--------- app/views/users/user_resource.js.erb | 1 + 7 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 app/views/users/_resource_search_form.html.erb create mode 100644 app/views/users/rename_resource.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0df07acff..6bbfbd12b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,7 +40,8 @@ class UsersController < ApplicationController :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, - :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist] + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist, + :user_resource,:user_resource_create,:user_resource_delete,:rename_resource,:search_user_course,:add_exist_file_to_course,:resource_preview,:resource_search] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, @@ -1139,11 +1140,37 @@ class UsersController < ApplicationController # 根据资源关键字进行搜索 def resource_search search = params[:search].to_s.strip.downcase - if User.current.id == params[:id] - @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and (filename like '%#{search}%') ").order("created_on desc") - else - @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and is_public = 1 and (filename like '%#{search}%') ").order("created_on desc") + # if User.current.id == params[:id] + # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and (filename like '%#{search}%') ").order("created_on desc") + # else + # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and is_public = 1 and (filename like '%#{search}%') ").order("created_on desc") + # end + if(params[:type].nil? || params[:type] == "1") #全部 + if User.current.id == params[:id] + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") + end + elsif params[:type] == "2" #课程资源 + if User.current.id == params[:id] + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course' and (filename like '%#{search}%')").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and (filename like '%#{search}%') ").order("created_on desc") + end + elsif params[:type] == "3" #项目资源 + if User.current.id == params[:id] + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like '%#{search}%') ").order("created_on desc") + end + elsif params[:type] == "4" #附件 + if User.current.id == params[:id] + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") + end end + @type = params[:type] respond_to do |format| format.js end diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb new file mode 100644 index 000000000..0c48514b3 --- /dev/null +++ b/app/views/users/_resource_search_form.html.erb @@ -0,0 +1,7 @@ +<%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id), + :remote=>true ,:method => 'post',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> + + <%= hidden_field_tag(:type,type) %> + <%= submit_tag '',:class=>'searchIcon',:style=>'border-style:none' %> + +<% end %> \ No newline at end of file diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 078ee2c94..6f9ba0fee 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -5,7 +5,7 @@
  • <%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename), - :title => attach.filename+"\n"+attach.description.to_s,:class=>'resourcesBlack'%> + :title => attach.filename,:class=>'resourcesBlack'%>
  • <%= number_to_human_size(attach.filesize) %>
  • <%= get_resource_type(attach.container_type)%>
  • diff --git a/app/views/users/rename_resource.js.erb b/app/views/users/rename_resource.js.erb new file mode 100644 index 000000000..5556fb313 --- /dev/null +++ b/app/views/users/rename_resource.js.erb @@ -0,0 +1 @@ +alert(1) \ No newline at end of file diff --git a/app/views/users/resource_preview.js.erb b/app/views/users/resource_preview.js.erb index a38d46374..c3e1fb3ab 100644 --- a/app/views/users/resource_preview.js.erb +++ b/app/views/users/resource_preview.js.erb @@ -1,3 +1,5 @@ <% if @preview_able %> top.location.href = '<%=download_named_attachment_path(@file.id, @file.filename, preview: true) %>' +<% else %> +window.alert('该资源不可预览') <% end %> \ No newline at end of file diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index d9b992129..1c54fc67e 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -71,13 +71,9 @@ -
    - <%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>@user.id), - :remote=>true ,:method => 'post',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> - - <%= submit_tag '',:class=>'searchIcon',:style=>'border-style:none' %> - - <% end %> +
    + <%= render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} %> +
    @@ -168,7 +164,7 @@ $(".resourcesList").click(function(e) { } //将当前行改变为白色 line.children().css("background-color", 'white'); - //当前行恢复编辑状态 + //当前行恢复编辑状态到链接状态 if(ele.nodeName != 'INPUT') { restore(); } @@ -210,6 +206,7 @@ $(".resourcesList").click(function(e) { '"/> '+ '<% end %>'); $("#res_name").focus(); + document.getElementById('res_name').scrollIntoView() } String.prototype.trim = function() { var str = this, @@ -219,38 +216,42 @@ $(".resourcesList").click(function(e) { while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); } + + //恢复编辑状态到链接状态 + //如果当前是编辑状态,任何的不在输入框里的单击右键事件都需要将编辑状态变回链接状态 + //如果是编辑状态,且做了修改,那么久要进行修改,并且将修改值经过处理替换到页面显示 function restore(){ + //上一行不为空 且链接不为空 if( last_line != null && res_link != null && res_link != '') { - name = $("#res_name").val().trim(); - if(name != res_name.trim()){ + name = $("#res_name") ? $("#res_name").val().trim() : $("#res_name") ; + if( name && name != res_name.trim()){ if(confirm('确定修改为 '+name)){ - //$("#res_name_form").submit(); -// $.ajax({ -// type:'post', -// url:'<%#=rename_resource_user_path(@user) %>', -// data: $("#res_name_form").serialize() -// }); $.post( '<%=rename_resource_user_path(@user) %>', $("#res_name_form").serialize(), function (data){ - if(data =='sucess'){ + if(data =='sucess'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 last_line.children().first().html(res_link); last_line.children().first().children().attr('title',name); - last_line.children().first().children().html(name); + last_line.children().first().children().html(name.length > 17? name.substring(0,17)+'...' : name); }else{ last_line.children().first().html(res_link); + res_link = null; //如果修改失败,恢复之后将res_link置空 } }, 'text' ); }else{ - //last_line.children().first().html(res_link); + last_line.children().first().html(res_link); + res_link = null; //如果没有做修改,恢复之后将res_link置空 } }else { last_line.children().first().html(res_link); + res_link = null;//如果没有做修改,恢复之后将res_link置空 } + + } } @@ -261,7 +262,7 @@ $(".resourcesList").click(function(e) { } line.children().css("background-color", 'white'); id = line.children().last().html(); - if (confirm('确定要删除资源' + line.children().first().children().attr('title').trim() + '么')){ + if (confirm('确定要删除资源"' + line.children().first().children().attr('title').trim() + '"么?')){ $.ajax({ type: 'post', url: '<%= user_resource_delete_user_path(@user)%>' + '?resource_id=' + id diff --git a/app/views/users/user_resource.js.erb b/app/views/users/user_resource.js.erb index 69fc3dd43..d69a769af 100644 --- a/app/views/users/user_resource.js.erb +++ b/app/views/users/user_resource.js.erb @@ -1 +1,2 @@ +$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); \ No newline at end of file From 6b5547462338521b53a9da9548a488b699e76de5 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 18 Aug 2015 15:27:16 +0800 Subject: [PATCH 310/378] =?UTF-8?q?=E4=BD=9C=E5=93=81=E8=A2=AB=E8=AF=84?= =?UTF-8?q?=E9=98=85=20=E4=BD=9C=E5=93=81=E8=A2=AB=E5=9B=9E=E5=A4=8D=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++++ app/models/journals_for_message.rb | 13 ++++++++++++- app/models/student_works_score.rb | 11 +++++++++++ app/views/users/user_messages.html.erb | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 770d7d049..3e50f3131 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -97,6 +97,8 @@ class UsersController < ApplicationController end # 用户消息 + # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅 + # issue:问题; def user_messages unless User.current.logged? render_403 @@ -123,6 +125,8 @@ class UsersController < ApplicationController @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") when 'poll' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + when 'works_reviewers' + @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") when 'issue' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") @user_course_messages = nil diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index bcae58174..da19ba1f2 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -58,9 +58,11 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 课程动态 has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + # 消息关联 + has_many :course_messages, :class_name => 'CourseMessage',:as =>:course_message ,:dependent => :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity, :act_as_course_activity + after_create :act_as_activity, :act_as_course_activity, :act_as_course_message after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -186,4 +188,13 @@ class JournalsForMessage < ActiveRecord::Base self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id) end end + + # 课程作品留言消息通知 + def act_as_course_message + if self.jour_type == 'StudentWorksScore' + if self.user_id != self.jour.user_id + self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.student_work.homework_common.course.id) + end + end + end end diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb index 8fa14f8de..639722389 100644 --- a/app/models/student_works_score.rb +++ b/app/models/student_works_score.rb @@ -5,6 +5,17 @@ class StudentWorksScore < ActiveRecord::Base belongs_to :user belongs_to :student_work has_many :journals_for_messages, :as => :jour, :dependent => :destroy + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy acts_as_attachable + + after_create :act_as_course_message + + # 评阅作品消息提示 + def act_as_course_message + if self.student_work + receiver = self.student_work.user + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false) + end + end end diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 2e7b110bf..93e0fe967 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -22,7 +22,7 @@
    <% if @new_message_count >0 %> <% unless @user_course_messages.nil? %> - <% @user_course_messages.each do |ucm| %> + <% @user_course_messages.each do |ucm| %> <% if ucm.course_message_type == "News" %>
    • <%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %>
    • From 32aef6f2891fd0fd50edd29b2ea88dc6c941c402 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 15:36:15 +0800 Subject: [PATCH 311/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 1c54fc67e..98984b3f9 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -28,8 +28,6 @@ function closeModal() { - //hideModal($("#popbox_upload")); - //$("#attachments_fields").html(''); $("#upload_box").css("display","none"); } @@ -48,19 +46,15 @@
      • - <%= link_to '全部' ,user_resource_user_path(:id=>@user.id,:type=>1),:remote=>true,:method => 'get',:class=>'resourcesGrey' %>
      • - <%= link_to '课程资源' ,user_resource_user_path(:id=>@user.id,:type=>2),:remote=>true,:method => 'get',:class=>'resourcesGrey' %>
      • - <%= link_to '项目资源' ,user_resource_user_path(:id=>@user.id,:type=>3),:remote=>true,:method => 'get',:class=>'resourcesGrey' %>
      • - <%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesGrey' %>
      @@ -73,7 +67,6 @@ 上传资源
    <%= render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} %> -
    From 375c016783b00bbbae617181011af267593b797c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 15:42:36 +0800 Subject: [PATCH 312/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 98984b3f9..f5a6c57f0 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -199,7 +199,7 @@ $(".resourcesList").click(function(e) { '"/> '+ '<% end %>'); $("#res_name").focus(); - document.getElementById('res_name').scrollIntoView() + $("html,body").animate({scrollTop:$("#res_name").offset().top},1000) } String.prototype.trim = function() { var str = this, From 5f2965540655e8f440f249ba1e6c1502531683d1 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 18 Aug 2015 16:35:19 +0800 Subject: [PATCH 313/378] =?UTF-8?q?issue=E7=8A=B6=E6=80=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 125 +++++++++++++------------ 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index af2ebd902..03cdda8ad 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -14,69 +14,69 @@
  • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
  • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
  • -
  • <%= link_to "我的留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'journal'} %>
  • +
  • <%= link_to "我的留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
  • - <% if @new_message_count >0 %> - <% unless @user_course_messages.nil? %> - <% @user_course_messages.each do |ucm| %> - <% if ucm.course_message_type == "News" %> - - <% end %> - <% if ucm.course_message_type == "HomeworkCommon" %> - - <% end %> - <% if ucm.course_message_type == "Poll" %> - - <% end %> - <% if ucm.course_message_type == "Message" %> - + <% if @new_message_count >0 %> + <% unless @user_course_messages.nil? %> + <% @user_course_messages.each do |ucm| %> + <% if ucm.course_message_type == "News" %> + + <% end %> + <% if ucm.course_message_type == "HomeworkCommon" %> + + <% end %> + <% if ucm.course_message_type == "Poll" %> + + <% end %> + <% if ucm.course_message_type == "Message" %> + + <% end %> +
    + <% end %> <% end %> -
    - <% end %> - <% end %> - - <% unless @user_forge_messages.nil? %> - <% @user_forge_messages.each do |ufm| %> + + <% unless @user_forge_messages.nil? %> + <% @user_forge_messages.each do |ufm| %> <% if ufm.forge_message_type == "Issue" %> <% end %> + <% end %> + <% end %> + <% else %> +
    暂无消息!
    <% end %> - <% end %> - <% else %> -
    暂无消息!
    - <% end %>
    From 90661066d36e8e81069c6d0bc242095a855f6e84 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 18 Aug 2015 16:53:26 +0800 Subject: [PATCH 314/378] =?UTF-8?q?=E5=8C=BA=E5=88=86=E8=AF=BE=E7=A8=8B/?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=20=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E9=A1=B9=E7=9B=AE/=E6=96=B0=E9=97=BB=20=E7=9A=84?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++++-- app/views/users/user_messages.html.erb | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d1073c8c3..00ce151cf 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -117,16 +117,20 @@ class UsersController < ApplicationController when 'homework' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") @user_forge_messages = nil - when 'message' + when 'course_message' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") + when 'forge_message' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") - when 'news' + when 'course_news' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") + when 'forge_news' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") when 'poll' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") when 'works_reviewers' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + when 'works_reply' + @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") when 'issue' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") @user_course_messages = nil diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 03cdda8ad..a4cc521ff 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -9,12 +9,17 @@
  • <%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %>
  • <%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %>
  • -
  • <%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %>
  • -
  • <%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %>
  • +
  • <%= link_to "课程讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_message'} %>
  • +
  • <%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_news'} %>
  • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
  • +
  • <%= link_to "作品评阅",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reviewers'} %>
  • +
  • <%= link_to "作品讨论",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reply'} %>
  • +
  • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
  • -
  • <%= link_to "我的留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
  • +
  • <%= link_to "问题更新",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
  • +
  • <%= link_to "项目讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_message'} %>
  • +
  • <%= link_to "项目新闻",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_news'} %>
  • From ae6260571b4d4321cf68d433f8d0c793dd9d0c94 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 16:57:41 +0800 Subject: [PATCH 315/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++---- app/views/users/user_resource.html.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6bbfbd12b..c3c5da9cf 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1106,25 +1106,25 @@ class UsersController < ApplicationController #确定container_type # @user = User.find(params[:id]) if(params[:type].nil? || params[:type] == "1") #全部 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' ").order("created_on desc") end elsif params[:type] == "3" #项目资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") end elsif params[:type] == "4" #附件 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index f5a6c57f0..09bee5ac6 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -199,7 +199,7 @@ $(".resourcesList").click(function(e) { '"/> '+ '<% end %>'); $("#res_name").focus(); - $("html,body").animate({scrollTop:$("#res_name").offset().top},1000) + $("html,body").animate({scrollTop:$("#res_name").offset().top},1000) } String.prototype.trim = function() { var str = this, From 652f5fa6e130a1d316530557803a4716fb1a7672 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 18 Aug 2015 17:00:58 +0800 Subject: [PATCH 316/378] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E7=95=99=E8=A8=80=E5=88=97=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E3=80=81=E6=9C=80=E8=BF=91=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E7=9A=84=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/course_messages.html.erb | 4 ++-- app/views/admin/latest_login_users.html.erb | 6 +++--- app/views/admin/leave_messages.html.erb | 4 ++-- app/views/admin/messages_list.html.erb | 10 +++++++--- app/views/admin/project_messages.html.erb | 4 ++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/views/admin/course_messages.html.erb b/app/views/admin/course_messages.html.erb index 3db0a3e11..c9e69357f 100644 --- a/app/views/admin/course_messages.html.erb +++ b/app/views/admin/course_messages.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(课程ID) 作者 diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 838cc0dcb..89514726a 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -9,10 +9,10 @@ <%= l(:label_filter_plural) %> - <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> - <%= calendar_for('startdate')%> + <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%> + <%= calendar_for('startdate')%>    - <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> + <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%> <%= calendar_for('enddate')%>   <%= submit_tag l(:button_apply), :class => "small", :name => nil %> <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_users'}, :class => 'icon icon-reload' %> diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index 360e9b864..dee8b7443 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -13,8 +13,8 @@ 类型 - - 来源 + + 来源(课程或用户ID) 留言人 diff --git a/app/views/admin/messages_list.html.erb b/app/views/admin/messages_list.html.erb index e0c84279d..ca84baa24 100644 --- a/app/views/admin/messages_list.html.erb +++ b/app/views/admin/messages_list.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(贴吧ID) 作者 @@ -50,7 +50,11 @@ <%= format_date(memo.created_at) %> - <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> + <% if memo.parent_id.nil? || memo.subject.starts_with?('RE:')%> + <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> + <% else %> + <%= link_to("RE:"+memo.subject, forum_memo_path(memo.forum, memo)) %> + <% end %> <%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %> diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb index dc44a7cba..a5639eba7 100644 --- a/app/views/admin/project_messages.html.erb +++ b/app/views/admin/project_messages.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(项目ID) 作者 From 43d57074e51277b505fc7d7f7ed781c2a81cb2a8 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 17:26:39 +0800 Subject: [PATCH 317/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/users/user_resource.html.erb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c3c5da9cf..2caae19e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -894,7 +894,7 @@ class UsersController < ApplicationController # format.js # end if @flag - render :text=>'sucess' + render :text=> download_named_attachment_path(@attachment.id, @attachment.filename) else render :text=>'fail' end diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 09bee5ac6..1cad8f2de 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -158,7 +158,7 @@ $(".resourcesList").click(function(e) { //将当前行改变为白色 line.children().css("background-color", 'white'); //当前行恢复编辑状态到链接状态 - if(ele.nodeName != 'INPUT') { + if(ele && ele.nodeName != 'INPUT') { restore(); } line = null; @@ -224,9 +224,10 @@ $(".resourcesList").click(function(e) { '<%=rename_resource_user_path(@user) %>', $("#res_name_form").serialize(), function (data){ - if(data =='sucess'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 + if(data != 'fail'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 last_line.children().first().html(res_link); last_line.children().first().children().attr('title',name); + last_line.children().first().children().attr('href',data); last_line.children().first().children().html(name.length > 17? name.substring(0,17)+'...' : name); }else{ last_line.children().first().html(res_link); From 3836cfb40ba4bcd3b07b3a8dfb7698f24dddb3d6 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 17:45:14 +0800 Subject: [PATCH 318/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resource_search_form.html.erb | 2 +- app/views/users/user_resource.html.erb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb index 0c48514b3..725167b65 100644 --- a/app/views/users/_resource_search_form.html.erb +++ b/app/views/users/_resource_search_form.html.erb @@ -1,6 +1,6 @@ <%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id), :remote=>true ,:method => 'post',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> - + <%= hidden_field_tag(:type,type) %> <%= submit_tag '',:class=>'searchIcon',:style=>'border-style:none' %> diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 1cad8f2de..621b0c17d 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -216,7 +216,10 @@ $(".resourcesList").click(function(e) { function restore(){ //上一行不为空 且链接不为空 if( last_line != null && res_link != null && res_link != '') { - name = $("#res_name") ? $("#res_name").val().trim() : $("#res_name") ; + name = $("#res_name").lenght != 0 && $("#res_name").val() != undefined ? $("#res_name").val().trim() : undefined ; + if (name == undefined || name === 'undefined' ){ //只要res_name没有值,那么就不是编辑状态 + return; + } if( name && name != res_name.trim()){ if(confirm('确定修改为 '+name)){ From e7f818deb9e62b599ab126b781eedbeef148a4bb Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 19 Aug 2015 09:20:39 +0800 Subject: [PATCH 319/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2caae19e1..bc9394716 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1146,25 +1146,25 @@ class UsersController < ApplicationController # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and is_public = 1 and (filename like '%#{search}%') ").order("created_on desc") # end if(params[:type].nil? || params[:type] == "1") #全部 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course' and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "3" #项目资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "4" #附件 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") From d657e9f3cc44e2964828eb6dd173eb9cd7c1bf38 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Aug 2015 11:06:39 +0800 Subject: [PATCH 320/378] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E8=B4=B4=E5=90=A7=20=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 11 ++-- app/models/forum.rb | 1 + app/models/forum_message.rb | 11 ++++ app/models/memo.rb | 30 ++++++++++- app/models/user.rb | 4 +- .../20150818091800_create_forum_messages.rb | 13 +++++ db/schema.rb | 50 ++++++++++++++++++- spec/factories/forum_messages.rb | 10 ++++ spec/models/forum_message_spec.rb | 5 ++ 9 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 app/models/forum_message.rb create mode 100644 db/migrate/20150818091800_create_forum_messages.rb create mode 100644 spec/factories/forum_messages.rb create mode 100644 spec/models/forum_message_spec.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 00ce151cf..d77ccb958 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -97,8 +97,8 @@ class UsersController < ApplicationController end # 用户消息 - # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅 - # issue:问题; + # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复 + # issue:问题;journal:缺陷状态更新; forum:公共贴吧 def user_messages unless User.current.logged? render_403 @@ -114,6 +114,7 @@ class UsersController < ApplicationController when nil @user_course_messages = @user.course_messages.reverse @user_forge_messages = @user.forge_messages.reverse + @user_forum_messages = @user.forum_messages.reverse when 'homework' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") @user_forge_messages = nil @@ -134,9 +135,11 @@ class UsersController < ApplicationController when 'issue' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") @user_course_messages = nil - when 'journal' - @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + when 'journal' # 缺陷状态更新、留言 + @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Forum", @user).order("created_at desc") @user_course_messages = nil + when 'forum' + @user_forum_messages = ForumMessage.where("memo_message_type =? and user_id =?", "Forum", @user).order("created_at desc") end respond_to do |format| format.html{render :layout=>'base_users_new'} diff --git a/app/models/forum.rb b/app/models/forum.rb index 2af1abf9e..530639f81 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -39,6 +39,7 @@ class Forum < ActiveRecord::Base logger.debug "send mail for forum add." Mailer.run.forum_add(self) if Setting.notified_events.include?('forum_add') end + # Updates topic_count, memo_count and last_memo_id attributes for +board_id+ def self.reset_counters!(forum_id) forum_id = forum_id.to_i diff --git a/app/models/forum_message.rb b/app/models/forum_message.rb new file mode 100644 index 000000000..c7b07e164 --- /dev/null +++ b/app/models/forum_message.rb @@ -0,0 +1,11 @@ +class ForumMessage < ActiveRecord::Base + attr_accessible :forum_id, :memo_message_id, :memo_message_type, :user_id, :viewed + + belongs_to :memo + belongs_to :user + + validates :user_id,presence: true + validates :forum_id,presence: true + validates :memo_message_id,presence: true + validates :memo_message_type, presence: true +end diff --git a/app/models/memo.rb b/app/models/memo.rb index e0abaa19f..e4dabf131 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -16,6 +16,8 @@ class Memo < ActiveRecord::Base acts_as_attachable has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj has_many :praise_tread, as: :praise_tread_object, dependent: :destroy + # 消息 + has_many :forum_messages, dependent: :destroy belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id' # acts_as_searchable :column => ['subject', 'content'], # #:include => { :forum => :p} @@ -44,7 +46,7 @@ class Memo < ActiveRecord::Base "parent_id", "replies_count" - after_create :add_author_as_watcher, :reset_counters!, :send_mail + after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message # after_update :update_memos_forum after_destroy :reset_counters!,:delete_kindeditor_assets#,:down_user_score -- 公共区发帖暂不计入得分 # after_create :send_notification @@ -59,6 +61,32 @@ class Memo < ActiveRecord::Base Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added') end + # 公共贴吧消息记录 + # 原则:贴吧创始人;发帖人,wanglingchun(特殊用户) + def send_message + receivers = [] + u = User.find(6) + receivers << u + # 主贴 + if self.parent_id.nil? + if self.author_id != self.forum.creator_id # 发帖人不是吧主 + receivers << self.forum.creator + end + else # 回帖 + # 添加吧主 + if self.author_id != self.forum.creator_id + receivers << self.forum.creator + end + # 添加发帖人 + if self.author_id != self.parent.author_id + receivers << self.parent.author + end + end + receivers.each do |r| + self.forum_messages << ForumMessage.new(:user_id => r.id, :forum_id => self.forum_id, :memo_message_id => self.id, :memo_message_type => "Forum", :viewed => false) + end + end + def cannot_reply_to_locked_topic errors.add :base, l(:label_memo_locked) if root.locked? && self != root end diff --git a/app/models/user.rb b/app/models/user.rb index 9f88ff53a..82ecdbd47 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -127,10 +127,10 @@ class User < Principal has_many :messages, :foreign_key => 'author_id' has_one :user_score, :dependent => :destroy has_many :documents # 项目中关联的文档再次与人关联 -# 关联虚拟表 +# 关联消息表 has_many :forge_messages has_many :course_messages -# end + has_many :forum_messages # 虚拟转换 has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" diff --git a/db/migrate/20150818091800_create_forum_messages.rb b/db/migrate/20150818091800_create_forum_messages.rb new file mode 100644 index 000000000..20ad1ca51 --- /dev/null +++ b/db/migrate/20150818091800_create_forum_messages.rb @@ -0,0 +1,13 @@ +class CreateForumMessages < ActiveRecord::Migration + def change + create_table :forum_messages do |t| + t.integer :user_id + t.integer :forum_id + t.integer :memo_message_id + t.string :memo_message_type + t.integer :viewed + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index db9b9ff9b..5471381d7 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 => 20150810064247) do +ActiveRecord::Schema.define(:version => 20150818091800) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -325,6 +325,15 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "updated_on", :null => false end + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_attachments", :force => true do |t| t.string "filename" t.string "disk_filename" @@ -357,6 +366,16 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "updated_at", :null => false end + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" @@ -455,6 +474,13 @@ ActiveRecord::Schema.define(:version => 20150810064247) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -536,6 +562,26 @@ ActiveRecord::Schema.define(:version => 20150810064247) do add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "forum_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_message_id" + t.string "memo_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -857,7 +903,6 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1461,6 +1506,7 @@ ActiveRecord::Schema.define(:version => 20150810064247) 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/spec/factories/forum_messages.rb b/spec/factories/forum_messages.rb new file mode 100644 index 000000000..adb114d3c --- /dev/null +++ b/spec/factories/forum_messages.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :forum_message do + user_id 1 +forum_id 1 +memo_message_id 1 +memo_message_type "MyString" +viewed 1 + end + +end diff --git a/spec/models/forum_message_spec.rb b/spec/models/forum_message_spec.rb new file mode 100644 index 000000000..e0159c3ca --- /dev/null +++ b/spec/models/forum_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ForumMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From ff3edf4d5e56e335e9cbaaeb0b536a42c3252545 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 19 Aug 2015 11:12:47 +0800 Subject: [PATCH 321/378] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 52 ++++++++++++++++++++++++++ public/stylesheets/public_new.css | 4 +- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index a4cc521ff..089dca32f 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -76,6 +76,26 @@ <% end %> <% end %> + <% if ucm.course_message_type == "StudentWorksScore" %> + + <% end %> + <% if ucm.course_message_type == "JournalsForMessage" %> + + <% end %>
    <% end %> <% end %> @@ -113,6 +133,38 @@
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • <% end %> + <% if ufm.forge_message_type == "Message" %> + + <% end %> + <% if ufm.forge_message_type == "News" %> + + <% end %> <% end %> <% end %> <% else %> diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index fb7e6fbf4..6837a5466 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -589,7 +589,7 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} .homepageNewsPortrait {width:40px; display:block; margin-top:7px;} .homepageNewsPublisher {width:80px; max-width:80px; margin-right:10px; font-size:12px; color:#15bccf; display:block; padding-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;} -.homepageNewsTypeNotRead {width:95px; font-size:12px; font-weight:bold; color:#4B4B4B; display:block;} +.homepageNewsTypeNotRead {width:95px; font-size:13px; font-weight:bold; color:#4B4B4B; display:block;} .homepageNewsContent {width:395px; max-width:395px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} a.homepageWhite {color:#ffffff;} @@ -598,7 +598,7 @@ a.newsGrey {color:#4b4b4b;} a.newsGrey:hover {color:#000000;} a.newsBlue {color:#15bccf;} a.newsBlue:hover {color:#0781b4;} -a.newsBlack {color:#4B4B4B; font-weight:bold;} +a.newsBlack {color:#4B4B4B; font-weight:bold; font-size:13px;} a.newsBlack:hover {color:#0781b4;} a.resourcesGrey {font-size:12px; color:#888888;} a.resourcesGrey:hover {font-size:12px; color:#15bccf;} From 2d282f73cb51286716fbc3900e37a2763a8cf193 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Aug 2015 11:21:48 +0800 Subject: [PATCH 322/378] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/message.rb b/app/models/message.rb index 4cc233eb5..37129885f 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -232,7 +232,6 @@ class Message < ActiveRecord::Base self.project.members.each do |m| if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息 self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false) - self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false) end end end From 0ef7d5f0fa23ac6f4e099770c8197242a4fc2228 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 19 Aug 2015 12:04:06 +0800 Subject: [PATCH 323/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index bc9394716..c523bbb3d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -14,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + class UsersController < ApplicationController layout :setting_layout @@ -1109,13 +1111,18 @@ class UsersController < ApplicationController if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + + "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' ").order("created_on desc") + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i @@ -1140,22 +1147,24 @@ class UsersController < ApplicationController # 根据资源关键字进行搜索 def resource_search search = params[:search].to_s.strip.downcase - # if User.current.id == params[:id] - # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and (filename like '%#{search}%') ").order("created_on desc") - # else - # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and is_public = 1 and (filename like '%#{search}%') ").order("created_on desc") - # end if(params[:type].nil? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" + + " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+ + " or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')})) )" + + " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course' and (filename like '%#{search}%')").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and (filename like '%#{search}%') ").order("created_on desc") + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type = 'Course') "+ + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')})) )"+ + " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i From 425e0dd89a953885f844e277730d4865ed633181 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Aug 2015 15:03:04 +0800 Subject: [PATCH 324/378] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=B6=88=E6=81=AF=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20=E9=83=A8=E5=88=86=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 17 ++++++++-- app/views/users/user_messages.html.erb | 44 +++++++++++++++++--------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d77ccb958..bc3719685 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -115,31 +115,42 @@ class UsersController < ApplicationController @user_course_messages = @user.course_messages.reverse @user_forge_messages = @user.forge_messages.reverse @user_forum_messages = @user.forum_messages.reverse + @user_course_messages_count = @user_course_messages.count + @user_forge_messages_count = @user_forum_messages.count when 'homework' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") - @user_forge_messages = nil + @user_course_messages_count = @user_course_messages.count when 'course_message' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @user_course_messages_count = @user_course_messages.count when 'forge_message' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") when 'course_news' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") + @user_course_messages_count = @user_course_messages.count when 'forge_news' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") when 'poll' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + @user_course_messages_count = @user_course_messages.count when 'works_reviewers' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + @user_course_messages_count = @user_course_messages.count when 'works_reply' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @user_course_messages_count = @user_course_messages.count when 'issue' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") - @user_course_messages = nil + @user_forge_messages_count = @user_forge_messages.count when 'journal' # 缺陷状态更新、留言 @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Forum", @user).order("created_at desc") - @user_course_messages = nil + @user_forge_messages_count = @user_forge_messages.count when 'forum' @user_forum_messages = ForumMessage.where("memo_message_type =? and user_id =?", "Forum", @user).order("created_at desc") + @user_forum_messages_count = @user_forum_messages.count + else + render_404 + return end respond_to do |format| format.html{render :layout=>'base_users_new'} diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 089dca32f..233b5bcb2 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -7,19 +7,31 @@
  • @@ -82,7 +94,7 @@
  • "><%= ucm.course_message.user %>
  • ">作品评阅
  • - <%= link_to ucm.course_message.comment, nil,:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%= link_to ucm.course_message.comment, student_work_path(ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %> %>
  • <%= time_tag(ucm.course_message.created_at).html_safe %>
  • <% end %> @@ -92,7 +104,7 @@
  • "><%= ucm.course_message.user %>
  • ">作品讨论
  • - <%= link_to ucm.course_message.notes, nil,:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%= link_to ucm.course_message.notes, student_work_path(ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% end %> @@ -167,6 +179,8 @@ <% end %> <% end %> <% end %> + <% unless @user_forum_messages.nil? %> + <% end %> <% else %>
    暂无消息!
    <% end %> From 929da7512da5d1c17d8e913b7e7937424faabead Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 19 Aug 2015 17:13:57 +0800 Subject: [PATCH 325/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 33 ++++++++- .../users/_resource_search_form.html.erb | 2 +- .../users/_resource_share_popup.html.erb | 15 +++- app/views/users/_resources_list.html.erb | 5 +- app/views/users/user_resource.html.erb | 58 +++++++++------- public/stylesheets/images/homepage_icon.png | Bin 0 -> 6829 bytes public/stylesheets/images/nav_icon.png | Bin 0 -> 3204 bytes public/stylesheets/public_new.css | 65 ++++++++++++++---- 8 files changed, 133 insertions(+), 45 deletions(-) create mode 100644 public/stylesheets/images/homepage_icon.png create mode 100644 public/stylesheets/images/nav_icon.png diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c523bbb3d..e4109e5bb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -825,7 +825,38 @@ class UsersController < ApplicationController # 删除用户资源 def user_resource_delete Attachment.delete(params[:resource_id]) - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") + #@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") + if(params[:type].nil? || params[:type] == "1") #全部 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") + else + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + + "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + end + elsif params[:type] == "2" #课程资源 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") + else + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + end + elsif params[:type] == "3" #项目资源 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") + end + elsif params[:type] == "4" #附件 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + end + end + @type = params[:type] respond_to do |format| format.js end diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb index 725167b65..5f854cba0 100644 --- a/app/views/users/_resource_search_form.html.erb +++ b/app/views/users/_resource_search_form.html.erb @@ -2,6 +2,6 @@ :remote=>true ,:method => 'post',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> <%= hidden_field_tag(:type,type) %> - <%= submit_tag '',:class=>'searchIcon',:style=>'border-style:none' %> + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> <% end %> \ No newline at end of file diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 01ac79075..cad94056c 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -1,8 +1,17 @@ -
    将资源移动至 -
    +
    +
    将资源发送至
    +
    + +
    +
    +
    +
    <%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> <%= hidden_field_tag(:send_id, @send_id) %> @@ -17,7 +26,7 @@ <%= hidden_field_tag(:send_id, @send_id) %> <% if !courses.empty? %> <% courses.each do |course| %> -
      +
      • diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 6f9ba0fee..b344c737d 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -1,7 +1,10 @@ <% if attachments.nil? || attachments.empty? %> <% else %> <% attachments.each do |attach| %> -
          +
            +
          • + +
          • <%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename), diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 621b0c17d..5867c463f 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -40,22 +40,22 @@ }
            -
            -
            资源
            +
            +
            资源库
              • - <%= link_to '全部' ,user_resource_user_path(:id=>@user.id,:type=>1),:remote=>true,:method => 'get',:class=>'resourcesGrey' %> + <%= link_to '全部' ,user_resource_user_path(:id=>@user.id,:type=>1),:remote=>true,:method => 'get',:class=>'resourcesTypeAll resourcesGrey' %>
              • - <%= link_to '课程资源' ,user_resource_user_path(:id=>@user.id,:type=>2),:remote=>true,:method => 'get',:class=>'resourcesGrey' %> + <%= link_to '课程资源' ,user_resource_user_path(:id=>@user.id,:type=>2),:remote=>true,:method => 'get',:class=>'homepagePostTypeAssignment postTypeGrey' %>
              • - <%= link_to '项目资源' ,user_resource_user_path(:id=>@user.id,:type=>3),:remote=>true,:method => 'get',:class=>'resourcesGrey' %> + <%= link_to '项目资源' ,user_resource_user_path(:id=>@user.id,:type=>3),:remote=>true,:method => 'get',:class=>'homepagePostTypeQuiz postTypeGrey' %>
              • - <%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesGrey' %> + <%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
            • @@ -63,14 +63,14 @@
            <%= render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} %>
              +
            • 资源名称
            • 大小
            • 类别
            • @@ -78,11 +78,21 @@
            • 上传时间
            -
            -
              - +
              <%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %> -
            +
            +
            +
            + +
            + 全选 + 删除 +
            +
            选择 10 个资源
            +
            + 发送 +
            +
          • -
          • <%= course.name%>
          • +
          • <%= truncate(course.name,:length=>18)%>
          <% end %> diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index 903212798..c5b9f8fbe 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -1 +1,2 @@ +alert('发送成功') closeModal(); \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb new file mode 100644 index 000000000..6ed846821 --- /dev/null +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -0,0 +1,2 @@ +alert('发送成功'); +closeModal(); \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb new file mode 100644 index 000000000..c22e4ad6d --- /dev/null +++ b/app/views/users/search_user_project.js.erb @@ -0,0 +1,11 @@ +var screenWidth = $(window).width(); +var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 +var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 +var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 +var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 +var popupHeight = $(".resourceSharePopup").outerHeight(true); +$(".resourceSharePopup").css("marginTop",-popupHeight/2); + +$("#upload_box").css('left',objLeft).css('top',objTop); +$("#upload_box").html('<%= escape_javascript( render :partial => "resource_share_for_project_popup" ,:locals => {:projects=>@projects,:user=>@user})%>'); +$("#upload_box").css('display','block'); \ No newline at end of file diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 5867c463f..6938e389e 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -3,7 +3,11 @@ <%= stylesheet_link_tag 'project' %> <%= stylesheet_link_tag 'leftside' %> <%= javascript_include_tag 'attachments'%> - + + + + + diff --git a/config/routes.rb b/config/routes.rb index c77a1e892..1318a495e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -350,8 +350,10 @@ RedmineApp::Application.routes.draw do post "user_resource_delete" get "search_user_course" post "add_exist_file_to_course" + post "add_exist_file_to_project" get 'resource_preview' post 'rename_resource' + get 'search_user_project' # end end end From 88fe0a69f46179dcacf48b7393194df92201db24 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 20 Aug 2015 10:38:14 +0800 Subject: [PATCH 331/378] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 40 ++++++++++++++++++-------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 37dbfa3f7..a40a54e95 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -12,9 +12,15 @@ <% unless @user_course_messages_count > 0 %>
        • <%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %>
        • <% end %> -
        • <%= link_to "课程讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_message'} %>
        • -
        • <%= link_to "发布了课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_news'} %>
        • -
        • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
        • + <% unless @user_course_messages_count > 0 %> +
        • <%= link_to "课程讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_message'} %>
        • + <% end %> + <% unless @user_course_messages_count > 0 %> +
        • <%= link_to "发布了课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_news'} %>
        • + <% end %> + <% unless @user_course_messages_count > 0 %> +
        • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
        • + <% end %> <% unless @user_course_messages_count > 0 %>
        • <%= link_to "作品评阅",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reviewers'} %>
        • <% end %> @@ -22,14 +28,24 @@ <% end %> <%# 项目相关消息 %> <% unless @user_forge_messages.nil? %> -
        • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
        • -
        • <%= link_to "更新了问题",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
        • -
        • <%= link_to "项目讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_message'} %>
        • -
        • <%= link_to "发布了新闻",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_news'} %>
        • + <% unless @user_forge_messages_count > 0 %> +
        • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
        • + <% end %> + <% unless @user_forge_messages_count > 0 %> +
        • <%= link_to "更新了问题",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
        • + <% end %> + <% unless @user_forge_messages_count > 0 %> +
        • <%= link_to "项目讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_message'} %>
        • + <% end %> + <% unless @user_forge_messages_count > 0 %> +
        • <%= link_to "发布了新闻",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_news'} %>
        • + <% end %> <% end %> <%# 公共贴吧 %> <% unless @user_forum_messages.nil? %> + <% unless @user_memo_messages_count > 0 %>
        • <%= link_to "发布了帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
        • + <% end %> <% end %> <%# 用户留言 %>
        @@ -179,9 +195,9 @@ <% end %> <% end %> <% end %> - <% unless @user_forum_messages.nil? %> - <% @user_forum_messages.each do |urm| %> - <% if urm.memo_message_type == "Forum" %> + <% unless @user_memo_messages.nil? %> + <% @user_memo_messages.each do |urm| %> + <% if urm.memo_type == "Memo" %> From 192f16ba795d91cb59f246f0e4fa80c929a63098 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 20 Aug 2015 10:38:22 +0800 Subject: [PATCH 332/378] =?UTF-8?q?=E4=BF=AE=E6=94=B9memo=E7=B1=BB=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84=E7=94=A8=E6=88=B7=E7=95=99?= =?UTF-8?q?=E8=A8=80=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/models/journals_for_message.rb | 3 ++- app/models/user_feedback_message.rb | 10 ++++++++++ spec/factories/user_feedback_messages.rb | 9 +++++++++ spec/models/user_feedback_message_spec.rb | 5 +++++ 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 app/models/user_feedback_message.rb create mode 100644 spec/factories/user_feedback_messages.rb create mode 100644 spec/models/user_feedback_message_spec.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5badac36e..74c3afaa7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -147,7 +147,7 @@ class UsersController < ApplicationController @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Forum", @user).order("created_at desc") @user_forge_messages_count = @user_forge_messages.count when 'forum' - @user_memo_messages = Memo.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") + @user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") @user_memo_messages_count = @user_memo_messages.count else render_404 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 818bdaa74..305e7742f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -209,7 +209,8 @@ class JournalsForMessage < ActiveRecord::Base end else # 留言回复 # 添加留言回复人 - if self.user_id != self.parent.user_id # 如果回帖人不是用户自己 + # reply_to = User.find(self.reply_id) + if self.user_id != self.parent.user_id && self.user_id != self.reply_id # 如果回帖人不是用户自己 receivers << User.find(self.reply_id) end if self.user_id != self.parent.jour_id diff --git a/app/models/user_feedback_message.rb b/app/models/user_feedback_message.rb new file mode 100644 index 000000000..98b53e973 --- /dev/null +++ b/app/models/user_feedback_message.rb @@ -0,0 +1,10 @@ +class UserFeedbackMessage < ActiveRecord::Base + attr_accessible :journals_for_message_id, :journals_for_message_type, :user_id, :viewed + + belongs_to :journals_for_message + belongs_to :user + + validates :user_id,presence: true + validates :journals_for_message_id,presence: true + validates :journals_for_message_type, presence: true +end diff --git a/spec/factories/user_feedback_messages.rb b/spec/factories/user_feedback_messages.rb new file mode 100644 index 000000000..26a768dad --- /dev/null +++ b/spec/factories/user_feedback_messages.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :user_feedback_message do + user_id 1 +journals_for_message_id 1 +journals_for_message_type "MyString" +viewed 1 + end + +end diff --git a/spec/models/user_feedback_message_spec.rb b/spec/models/user_feedback_message_spec.rb new file mode 100644 index 000000000..4ea61c36a --- /dev/null +++ b/spec/models/user_feedback_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe UserFeedbackMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From b5682adcd3aa7c524200ccba0e17e9f1a566586d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 20 Aug 2015 10:50:40 +0800 Subject: [PATCH 333/378] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 1 + app/models/journals_for_message.rb | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 74c3afaa7..6c91fd805 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -131,6 +131,7 @@ class UsersController < ApplicationController @user_course_messages_count = @user_course_messages.count when 'forge_news' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") + @user_forge_messages_count = @user_forge_messages.count when 'poll' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") @user_course_messages_count = @user_course_messages.count diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 305e7742f..ce58fdc69 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -210,12 +210,13 @@ class JournalsForMessage < ActiveRecord::Base else # 留言回复 # 添加留言回复人 # reply_to = User.find(self.reply_id) - if self.user_id != self.parent.user_id && self.user_id != self.reply_id # 如果回帖人不是用户自己 + if self.user_id != self.parent.user_id && self.user_id != self.reply_id && self.user_id != self.jour_id# 如果回帖人不是用户自己 receivers << User.find(self.reply_id) - end - if self.user_id != self.parent.jour_id receivers << self.parent.jour end + # if self.user_id != self.parent.jour_id + # receivers << self.parent.jour + # end end if self.jour_type == 'Principal' if self.user_id != self.jour_id From 107a5686d1cb522ea149f1ca4df8d4f6af4f400c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 20 Aug 2015 11:37:32 +0800 Subject: [PATCH 334/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E5=85=A8?= =?UTF-8?q?=E9=80=89=E5=8F=8D=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 2 +- app/views/users/user_resource.html.erb | 70 +++++++++++++++++++++++- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index b344c737d..7a18a037b 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -3,7 +3,7 @@ <% attachments.each do |attach| %>
        • - +
        • diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 6938e389e..1ead2447c 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -87,12 +87,12 @@
    - +
    全选 删除
    -
    选择 10 个资源
    +
    选择 0 个资源
    @@ -179,6 +179,72 @@ $(".resourcesList").click(function(e) { } line = null; }); + //只要有一个选中了就是true + function checkboxSelected(){ + selected = false; + $("#resources_list").find("input[name='checkbox1']").each(function(){ + if($(this).attr('checked') == true){ + selected = true; + } + }); + return selected; + } + //只有全选才是true + function checkboxAllSelected(){ + allSelected = true; + $("#resources_list").find("input[name='checkbox1']").each(function(){ + if($(this).attr('checked') == undefined){ + allSelected = false; + } + }); + return allSelected; + } + //只有全部不选才是true + function checkboxAllDeselected(){ + allDeselected = true; + $("#resources_list").find("input[name='checkbox1']").each(function(){ + if($(this).attr('checked') == 'checked'){ + allDeselected = false; + } + }); + return allDeselected; + } + //查看所有的checkbox状态,并且按情况更改$("#checkboxAll")的状态 + function checkAllBox(checkbox){ + //只有选中当前checkbox且这个时候所有的checkbox都被选中了,$("#checkboxAll")才是被选中状态,其余都是非选中状态 + if(checkbox.attr('checked') == 'checked' && checkboxAllSelected()){ + $("#checkboxAll").attr('checked',true); + }else{ + $("#checkboxAll").attr('checked',false); + } + $("#res_count").html(getCheckBoxSeletedCount()); + + } + //获取当前checkbox选中的数目 + function getCheckBoxSeletedCount(){ + var i = 0; + $("#resources_list").find("input[name='checkbox1']").each(function(){ + if($(this).attr('checked') == 'checked'){ + i ++; + } + }); + return i; + } + $("#checkboxAll").click(function(e){ + + if($(this).attr('checked')){ + $("#resources_list").find("input[name='checkbox1']").each(function(){ + $(this).attr('checked',true); + }); + $("#res_count").html('<%= @attachments.size%>'); + }else{ + $("#resources_list").find("input[name='checkbox1']").each(function(){ + $(this).attr('checked',false); + }); + $("#res_count").html(0); + } + }); + function show_send(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} From 84182171f5d6d4082f33634edb9e9f0a19d09a2d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 20 Aug 2015 12:41:53 +0800 Subject: [PATCH 335/378] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index a40a54e95..2e53dfe6e 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -9,42 +9,44 @@
  • <%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %>
  • <%# 课程相关消息 %> <% unless @user_course_messages.nil? %> - <% unless @user_course_messages_count > 0 %> + <% if @user_course_messages_count > 0 %>
  • <%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %>
  • <% end %> - <% unless @user_course_messages_count > 0 %> + <% if @user_course_messages_count > 0 %>
  • <%= link_to "课程讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_message'} %>
  • <% end %> - <% unless @user_course_messages_count > 0 %> + <% if @user_course_messages_count > 0 %>
  • <%= link_to "发布了课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'course_news'} %>
  • <% end %> - <% unless @user_course_messages_count > 0 %> + <% if @user_course_messages_count > 0 %>
  • <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
  • <% end %> - <% unless @user_course_messages_count > 0 %> -
  • <%= link_to "作品评阅",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reviewers'} %>
  • + <% if @user_course_messages_count > 0 %> +
  • <%= link_to "作品评阅",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reviewers'} %>
  • + <% end %> + <% if @user_course_messages_count > 0 %> +
  • <%= link_to "作品讨论",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reply'} %>
  • <% end %> -
  • <%= link_to "作品讨论",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reply'} %>
  • <% end %> <%# 项目相关消息 %> <% unless @user_forge_messages.nil? %> - <% unless @user_forge_messages_count > 0 %> + <% if @user_forge_messages_count > 0 %>
  • <%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %>
  • <% end %> - <% unless @user_forge_messages_count > 0 %> + <% if @user_forge_messages_count > 0 %>
  • <%= link_to "更新了问题",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue_update'} %>
  • <% end %> - <% unless @user_forge_messages_count > 0 %> + <% if @user_forge_messages_count > 0 %>
  • <%= link_to "项目讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_message'} %>
  • <% end %> - <% unless @user_forge_messages_count > 0 %> + <% if @user_forge_messages_count > 0 %>
  • <%= link_to "发布了新闻",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forge_news'} %>
  • <% end %> <% end %> <%# 公共贴吧 %> - <% unless @user_forum_messages.nil? %> - <% unless @user_memo_messages_count > 0 %> -
  • <%= link_to "发布了帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • + <% unless @user_memo_messages.nil? %> + <% if @user_memo_messages_count > 0 %> +
  • <%= link_to "发布了xiang帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • <% end %> <% end %> <%# 用户留言 %> From e4dda89c075b51f98cb855697bb4af04893962d5 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 20 Aug 2015 12:44:32 +0800 Subject: [PATCH 336/378] =?UTF-8?q?=E6=B6=88=E6=81=AF---=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=95=99=E8=A8=80=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 +++++++- app/models/journals_for_message.rb | 21 ++++++++++--------- app/views/users/user_messages.html.erb | 28 +++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6c91fd805..686ffbb89 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -98,7 +98,7 @@ class UsersController < ApplicationController # 用户消息 # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复 - # issue:问题;journal:缺陷状态更新; forum:公共贴吧 + # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言 def user_messages unless User.current.logged? render_403 @@ -115,9 +115,11 @@ class UsersController < ApplicationController @user_course_messages = @user.course_messages.reverse @user_forge_messages = @user.forge_messages.reverse @user_memo_messages = @user.memo_messages.reverse + @user_feedback_messages = @user.user_feedback_messages.reverse @user_course_messages_count = @user_course_messages.count @user_forge_messages_count = @user_forge_messages.count @user_memo_messages_count = @user_memo_messages.count + @user_feedback_messages_count = @user_feedback_messages.count when 'homework' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") @user_course_messages_count = @user_course_messages.count @@ -126,6 +128,7 @@ class UsersController < ApplicationController @user_course_messages_count = @user_course_messages.count when 'forge_message' @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @user_forge_messages_count = @user_forge_messages.count when 'course_news' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") @user_course_messages_count = @user_course_messages.count @@ -150,6 +153,9 @@ class UsersController < ApplicationController when 'forum' @user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") @user_memo_messages_count = @user_memo_messages.count + when 'user_feedback' + @user_feedback_messages = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "Principal", @user).order("created_at desc") + @user_feedback_messages_count = @user_feedback_messages.count else render_404 return diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index ce58fdc69..2c397ffcf 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -209,21 +209,24 @@ class JournalsForMessage < ActiveRecord::Base end else # 留言回复 # 添加留言回复人 - # reply_to = User.find(self.reply_id) - if self.user_id != self.parent.user_id && self.user_id != self.reply_id && self.user_id != self.jour_id# 如果回帖人不是用户自己 - receivers << User.find(self.reply_id) - receivers << self.parent.jour + reply_to = User.find(self.reply_id) + if self.user_id != self.parent.user_id # 如果回帖人不是用户自己 + receivers << self.parent.jour + if self.reply_id != self.parent.user_id + receivers << reply_to + end + else # 用户自己回复别人的,别人收到消息通知 + if self.user_id != self.reply_id # 过滤掉自己回复自己的 + receivers << reply_to + end end - # if self.user_id != self.parent.jour_id - # receivers << self.parent.jour - # end end if self.jour_type == 'Principal' - if self.user_id != self.jour_id + receivers.each do |r| self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) end - end + end end end diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index a40a54e95..cb7fb0e60 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -25,6 +25,7 @@
  • <%= link_to "作品评阅",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reviewers'} %>
  • <% end %>
  • <%= link_to "作品讨论",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'works_reply'} %>
  • + <% end %> <%# 项目相关消息 %> <% unless @user_forge_messages.nil? %> @@ -44,10 +45,15 @@ <%# 公共贴吧 %> <% unless @user_forum_messages.nil? %> <% unless @user_memo_messages_count > 0 %> -
  • <%= link_to "发布了帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • +
  • <%= link_to "发布了帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • <% end %> <% end %> <%# 用户留言 %> + <% unless @user_forge_messages.nil? %> + <% unless @user_forge_messages_count > 0 %> +
  • <%= link_to "用户留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'user_feedback'} %>
  • + <% end %> + <% end %> @@ -214,6 +220,26 @@ <% end %> <% end %> <% end %> + <%# 用户留言消息 %> + <% unless @user_feedback_messages.nil? %> + <% @user_forge_messages.each do |urm| %> + <% if urm.memo_type == "Memo" %> + + <% end %> + <% end %> + <% end %> <% else %>
    暂无消息!
    <% end %> From ee09a105d2eba38fa53250cb8302c2224bf155ba Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 20 Aug 2015 12:46:31 +0800 Subject: [PATCH 337/378] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 2e53dfe6e..c34a31a3c 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -46,7 +46,7 @@ <%# 公共贴吧 %> <% unless @user_memo_messages.nil? %> <% if @user_memo_messages_count > 0 %> -
  • <%= link_to "发布了xiang帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • +
  • <%= link_to "发布了帖子",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'forum'} %>
  • <% end %> <% end %> <%# 用户留言 %> From 6b847e27d98db77189acb5b784771ff3f644cfee Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 20 Aug 2015 14:00:31 +0800 Subject: [PATCH 338/378] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 4 ++-- app/views/users/user_messages.html.erb | 30 ++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2c397ffcf..bb59f612d 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -210,8 +210,8 @@ class JournalsForMessage < ActiveRecord::Base else # 留言回复 # 添加留言回复人 reply_to = User.find(self.reply_id) - if self.user_id != self.parent.user_id # 如果回帖人不是用户自己 - receivers << self.parent.jour + if self.user_id != self.parent.user_id && self.user_id != self.parent.jour_id # 如果回帖人不是用户自己 + receivers << self.parent.user if self.reply_id != self.parent.user_id receivers << reply_to end diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 80deeb8f6..adfc6290b 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -51,8 +51,8 @@ <% end %> <% end %> <%# 用户留言 %> - <% unless @user_forge_messages.nil? %> - <% unless @user_forge_messages_count > 0 %> + <% unless @user_feedback_messages.nil? %> + <% if @user_feedback_messages_count > 0 %>
  • <%= link_to "用户留言",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'user_feedback'} %>
  • <% end %> <% end %> @@ -224,20 +224,28 @@ <% end %> <%# 用户留言消息 %> <% unless @user_feedback_messages.nil? %> - <% @user_forge_messages.each do |urm| %> - <% if urm.memo_type == "Memo" %> + <% @user_feedback_messages.each do |ufm| %> + <% if ufm.journals_for_message_type == "Principal" %> <% end %> <% end %> From f97a55e16438e0408b2b5939fcc03b7bb42e97d2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 20 Aug 2015 14:01:33 +0800 Subject: [PATCH 339/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 9 ++++- app/views/users/_resources_list.html.erb | 2 +- app/views/users/user_resource.html.erb | 47 +++++++++++++++++------- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 76ce9efaf..f62286973 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -823,9 +823,16 @@ class UsersController < ApplicationController end end - # 删除用户资源 + # 删除用户资源,分为批量删除 和 单个删除 def user_resource_delete + if params[:resource_id].present? Attachment.delete(params[:resource_id]) + elsif params[:checkbox1].present? + params[:checkbox1].each do |id| + Attachment.delete(id) + end + end + #@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") if(params[:type].nil? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 7a18a037b..62e819b43 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -3,7 +3,7 @@ <% attachments.each do |attach| %>
    • - +
    • diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 1ead2447c..7b173409a 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -82,22 +82,26 @@
    • 上传时间
    +
    + <%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %> +
    - +
    - 全选 - 删除 + 全选 + 删除
    选择 0 个资源
    +
    -
    From 7deafac2802284ae99078d41d5e200f39d6d36ad Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 21 Aug 2015 10:02:26 +0800 Subject: [PATCH 352/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 22 +++++++++++++--------- app/views/layouts/base_users_new.html.erb | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b4cb04019..76e287a43 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -838,7 +838,7 @@ class UsersController < ApplicationController if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") else - user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个公开资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") @@ -1237,20 +1237,22 @@ class UsersController < ApplicationController # @user = User.find(params[:id]) if(params[:type].nil? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + "or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") else - user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + - "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') ").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ - "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "3" #项目资源 if User.current.id.to_i == params[:id].to_i @@ -1284,12 +1286,14 @@ class UsersController < ApplicationController search = params[:search].to_s.strip.downcase if(params[:type].nil? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 + @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + " or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" + " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+ - " or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')})) )" + + " or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')})) )" + " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1298,7 +1302,7 @@ class UsersController < ApplicationController else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type = 'Course') "+ - "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')})) )"+ + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')})) )"+ " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "3" #项目资源 diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index f9f065e2a..be75f53f1 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -149,7 +149,7 @@ @@ -169,7 +169,7 @@ <% end %> From 9b827a698cc4b2f003e22a3bec4b52303c725be9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 21 Aug 2015 10:02:58 +0800 Subject: [PATCH 353/378] =?UTF-8?q?=E9=BC=A0=E6=A0=87=E7=BB=8F=E8=BF=87?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E6=98=BE=E7=A4=BA=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 46 +++++++++++++++++--------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 602e3c5c9..c9b17d09f 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -42,7 +42,9 @@
  • "><%= ucm.course_message.author %>
  • ">发布通知
  • - <%= link_to "#{ucm.course_message.title.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
  • + <%= link_to "#{ucm.course_message.title.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.id }, + :class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}", + :title => "#{ucm.course_message.title.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% end %> @@ -52,7 +54,9 @@
  • <%= ucm.course_message.author %>
  • ">回复了通知
  • - <%= link_to "#{ucm.course_message.comments.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.commented.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
  • + <%= link_to "#{ucm.course_message.comments.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.commented.id }, + :class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}", + :title => "#{ucm.course_message.comments.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% end %> @@ -62,7 +66,7 @@
  • <%= ucm.course_message.user %>
  • 发布作业
  • - <%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id),:class => "newsGrey" %>
  • + <%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id),:class => "newsGrey", :title => "#{ucm.course_message.name}" %>
  • <%= time_tag(ucm.course_message.created_at).html_safe %>
  • <% end %> @@ -72,7 +76,9 @@
  • "><%= ucm.course_message.user %>
  • ">发布问卷
  • - <%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id), + :class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}", + :title => "#{ucm.course_message.polls_name}" %>
  • <%= time_tag(ucm.course_message.created_at).html_safe %>
  • <% end %> @@ -83,12 +89,16 @@ <% if ucm.course_message.parent_id.nil? %>
  • ">发布帖子
  • - <%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, + :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}", + :title => "#{ucm.course_message.subject.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% else %>
  • ">回复帖子
  • - <%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, + :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}", + :title => "#{ucm.course_message.subject.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% end %> @@ -99,7 +109,7 @@
  • <%= ucm.course_message.user %>
  • 评阅了作品
  • - <%= link_to ucm.course_message.comment.html_safe, student_work_index_path(:homework => ucm.course_message.student_work.homework_common_id),:class=>"newsGrey" %>
  • + <%= link_to ucm.course_message.comment.html_safe, student_work_index_path(:homework => ucm.course_message.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ucm.course_message.comment.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_at).html_safe %>
  • <% end %> @@ -109,7 +119,7 @@
  • <%= ucm.course_message.user %>
  • 回复了作品
  • - <%= link_to ucm.course_message.notes.html_safe, student_work_index_path(:homework => ucm.course_message.jour.student_work.homework_common_id),:class=>"newsGrey" %>
  • + <%= link_to ucm.course_message.notes.html_safe, student_work_index_path(:homework => ucm.course_message.jour.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ucm.course_message.notes.html_safe}" %>
  • <%= time_tag(ucm.course_message.created_on).html_safe %>
  • <% end %> @@ -129,7 +139,7 @@
  • ">指派问题给我
  • - <%= link_to ("#{ufm.forge_message.subject.html_safe}"), issue_path(:id => ufm.forge_message.id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%= link_to ("#{ufm.forge_message.subject.html_safe}"), issue_path(:id => ufm.forge_message.id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ufm.forge_message.subject.html_safe}" %>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • @@ -145,7 +155,9 @@
  • "> <%= ufm.forge_message.notes.empty? ? "更新了问题状态" : "在问题中留言了" %>
  • - <%= link_to ("#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }"), issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%= link_to ("#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }"), + issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}", + :title => "#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }" %>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • @@ -157,7 +169,10 @@
  • "><%= ufm.forge_message.parent_id.nil? ? "发布帖子" : "回复帖子" %>
  • - <%=link_to ufm.forge_message.subject.html_safe, project_boards_path(ufm.forge_message.project,:parent_id => ufm.forge_message.parent_id ? ufm.forge_message.parent_id : ufm.forge_message.id, :topic_id => ufm.forge_message.id),:class=>"#{ufm.viewed==0?"newsBlack":"newsGrey"}" %>
  • + <%=link_to ufm.forge_message.subject.html_safe, project_boards_path(ufm.forge_message.project, + :parent_id => ufm.forge_message.parent_id ? ufm.forge_message.parent_id : ufm.forge_message.id, + :topic_id => ufm.forge_message.id),:class=>"#{ufm.viewed==0?"newsBlack":"newsGrey"}", + :title => "#{ufm.forge_message.subject.html_safe}" %>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • @@ -172,7 +187,7 @@
  • 发布新闻
  • - <%= link_to ("#{ufm.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ufm.forge_message.id}, :class => "newsGrey" %> + <%= link_to ("#{ufm.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ufm.forge_message.id}, :class => "newsGrey", :title => "#{ufm.forge_message.title.html_safe}" %>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • @@ -183,7 +198,8 @@
  • <%= ufm.forge_message.author %>
  • 回复了新闻
  • - <%= link_to "#{ufm.forge_message.comments.html_safe}", {:controller => 'news', :action => 'show', :id => ufm.forge_message.commented.id },:class =>"#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
  • + <%= link_to "#{ufm.forge_message.comments.html_safe}", + {:controller => 'news', :action => 'show', :id => ufm.forge_message.commented.id },:class =>"#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ufm.forge_message.comments.html_safe}"%>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • <% end %> @@ -202,7 +218,7 @@
  • 回复了贴吧帖子
  • - <%= link_to urm.memo.content.html_safe, forum_memo_path(urm.memo.forum_id, urm.memo.parent_id ? urm.memo.parent_id: urm.memo.id),:class => "newsGrey" %> + <%= link_to urm.memo.content.html_safe, forum_memo_path(urm.memo.forum_id, urm.memo.parent_id ? urm.memo.parent_id: urm.memo.id),:class => "newsGrey" , :title => "#{urm.memo.content.html_safe}" %>
  • <%= time_tag(urm.memo.created_at).html_safe %>
  • @@ -222,7 +238,7 @@
  • <%= ufm.journals_for_message.reply_id == 0 ? "给你留言了" : "回复了你的留言" %>
  • - <%= link_to ufm.journals_for_message.notes.html_safe, feedback_path(ufm.journals_for_message.jour_id), :class => "newsGrey" %> + <%= link_to ufm.journals_for_message.notes.html_safe, feedback_path(ufm.journals_for_message.jour_id), :class => "newsGrey", :title => "#{ufm.journals_for_message.notes.html_safe}" %>
  • <%= time_tag(ufm.journals_for_message.created_on).html_safe %>
  • From 3c6484269d999110a30df3d7ad7349ba26a465bc Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 21 Aug 2015 10:14:04 +0800 Subject: [PATCH 354/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E5=88=A0=E9=99=A4=E4=B8=8A=E4=BC=A0=E8=80=85=E4=B8=BA?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 78 ++++++++++++--------- app/views/users/user_resource_delete.js.erb | 3 +- 2 files changed, 45 insertions(+), 36 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 76e287a43..5d569e247 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -823,48 +823,56 @@ class UsersController < ApplicationController end end - # 删除用户资源,分为批量删除 和 单个删除 + # 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源 def user_resource_delete if params[:resource_id].present? - Attachment.delete(params[:resource_id]) + Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id]) elsif params[:checkbox1].present? params[:checkbox1].each do |id| - Attachment.delete(id) + Attachment.where("author_id = #{User.current.id}").delete(id) end end - #@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") - if(params[:type].nil? || params[:type] == "1") #全部 - if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") - else - user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个公开资源的课程是不是在 这个user的所有我可见的课程中 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + - "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") - end - elsif params[:type] == "2" #课程资源 - if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") - else - user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 - @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ - "or (container_type = 'Course' and is_public <> -1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") - end - elsif params[:type] == "3" #项目资源 - if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") - else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") - end - elsif params[:type] == "4" #附件 - if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") - else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") - end - end - @type = params[:type] + if(params[:type].nil? || params[:type] == "1") #全部 + if User.current.id.to_i == params[:id].to_i + user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + "or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + else + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + + "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + end + elsif params[:type] == "2" #课程资源 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') ").order("created_on desc") + else + user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 + @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+ + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.join(',')}))").order("created_on desc") + end + elsif params[:type] == "3" #项目资源 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") + end + elsif params[:type] == "4" #附件 + if User.current.id.to_i == params[:id].to_i + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + else + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + end + end + @type = params[:type] + @limit = 10 + @is_remote = true + @obj_count = @attachments.count + @obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1 + @offset ||= @obj_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @attachments = paginateHelper @attachments,10 respond_to do |format| format.js end diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb index 69fc3dd43..1a7469f25 100644 --- a/app/views/users/user_resource_delete.js.erb +++ b/app/views/users/user_resource_delete.js.erb @@ -1 +1,2 @@ -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); \ No newline at end of file +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); \ No newline at end of file From cf243d47e5ba5d2581ec718913462bab234e47a4 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 21 Aug 2015 10:28:29 +0800 Subject: [PATCH 355/378] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E5=88=A0=E9=99=A4=E4=B8=8A=E4=BC=A0=E8=80=85=E4=B8=BA?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 1 + app/views/users/user_resource.html.erb | 48 ++++++++++++++---------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 0099ba40b..fd72c99e4 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -14,6 +14,7 @@
  • <%= number_to_human_size(attach.filesize) %>
  • <%= get_resource_type(attach.container_type)%>
  • <%=User.find(attach.author_id).realname %>
  • +
  • <%= attach.author_id %>
  • <%= format_date(attach.created_on) %>
  • <%= attach.id %>
  • diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index fad50d683..19cfe2407 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -113,10 +113,10 @@ <%= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>