From 2e561de52500f7e1ddddea2d757d2e15a604c42f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 31 Jul 2015 16:32:55 +0800 Subject: [PATCH 001/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=86=85=E9=83=A8?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E5=8F=B7#2264=E4=B9=9F=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=EF=BC=9A=E5=85=B6=E5=AE=9E=E9=99=85=E7=9A=84?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 8c12d62e0..b72558de4 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -2,11 +2,11 @@

<%= l(:label_issue_edit) %>

-<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> +<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.id}" %>
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %> - <%= "#" + @issue.project_index %> + <%= "#" + @issue.id.to_s %>
From bb8b1f3f0899cd2cce795db74c6cd7d62cc50662 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 12 Aug 2015 17:43:22 +0800 Subject: [PATCH 002/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=AE=A1=E7=90=86git=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_repositories.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index ca771a487..c31ef5560 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -64,7 +64,7 @@
  • - <%= select_tag('repository_scm', + <%= label_tag('repository_scm', options_for_select(["Git"],@repository.class.name.demodulize), :data => {:remote => true, :method => 'get'})%> <% if @repository && ! @repository.class.scm_available %> From b1c8fdd9048ffbacd12f989022fa79c9ebcacfd5 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 13 Aug 2015 15:38:14 +0800 Subject: [PATCH 003/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E7=A0=81=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 | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f042bba50..1d0e99d1f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,7 +86,6 @@ class ProjectsController < ApplicationController @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) else @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) - @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) end @projects = @project_pages.order("created_on desc") @limit = 10#per_page_option From f262a7cc1300e5c9e3d6ebae096a6ee469c7f2a0 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 22:05:31 +0800 Subject: [PATCH 004/913] cffd --- db/schema.rb | 58 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 95f79b84b..912911185 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 => 20151120134208) do +ActiveRecord::Schema.define(:version => 20151120115137) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -241,6 +241,58 @@ ActiveRecord::Schema.define(:version => 20151120134208) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -539,7 +591,7 @@ ActiveRecord::Schema.define(:version => 20151120134208) do end create_table "exercise_questions", :force => true do |t| - t.text "question_title" + t.string "question_title" t.integer "question_type" t.integer "question_number" t.integer "exercise_id" @@ -568,7 +620,7 @@ ActiveRecord::Schema.define(:version => 20151120134208) do end create_table "exercises", :force => true do |t| - t.text "exercise_name" + t.string "exercise_name" t.text "exercise_description" t.integer "course_id" t.integer "exercise_status" From d2a87127da4eda0e15cd422d1c3510c9516d05a3 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 23 Nov 2015 09:32:03 +0800 Subject: [PATCH 005/913] =?UTF-8?q?=E6=88=91=E7=9A=84=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=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_organizations.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index e9d78e695..50bb24000 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -6,12 +6,12 @@
    组织列表 - - + <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + - - - + + 搜索 + <% end %>
    From 1914639bc309ad486ae300d103832ef0003e39c0 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 23 Nov 2015 10:17:20 +0800 Subject: [PATCH 006/913] =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9F=90=E6=88=90=E5=91=98=E5=90=8E=EF=BC=8C=E5=9C=A8=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E4=B8=AD=E8=BE=93=E5=85=A5=E7=9A=84=E8=AF=A5?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=85=B3=E9=94=AE=E5=AD=97=E5=B0=B1=E8=A6=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_member/create.js.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/org_member/create.js.erb b/app/views/org_member/create.js.erb index f1e48281f..25bbded34 100644 --- a/app/views/org_member/create.js.erb +++ b/app/views/org_member/create.js.erb @@ -4,4 +4,5 @@ $("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>'); $("#principals_for_new_member").html(''); $("#org_members_count_id").html("<%= @org.org_members.count %>"); + $("#not_org_member_search").val(""); <% end %> \ No newline at end of file From 71e98c873d70e19218cacc8d3cbd9b0638d56b80 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 23 Nov 2015 16:40:21 +0800 Subject: [PATCH 007/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=A1=86=E4=B8=AD=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E4=B8=BA=E7=81=B0=E8=89=B2=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E7=84=A6=E7=82=B9=E6=94=BE=E5=9C=A8=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=9B=BE=E7=89=87=E9=A2=9C=E8=89=B2=E5=8F=98?= =?UTF-8?q?=E4=BA=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_org_document.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index e74da846e..0142e6f37 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -87,7 +87,7 @@
-
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
From 68bb1422781e1f8f898dda61d22601761ed9fc66 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 23 Nov 2015 17:29:55 +0800 Subject: [PATCH 008/913] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87bug?= =?UTF-8?q?:=E5=8A=A8=E6=80=81=E8=BF=87=E6=BB=A4=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E2=80=9C=E5=B1=95=E5=BC=80=E6=9B=B4=E5=A4=9A=E2=80=9D?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E9=80=9A=E7=9F=A5=E7=AD=89=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_organizations.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index 50bb24000..e9d78e695 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -6,12 +6,12 @@
组织列表 - <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> - + + - - 搜索 - <% end %> + + +
From 591984ba63b37ceb69cc0ab93a2ab6bb93219331 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 23 Nov 2015 21:54:40 +0800 Subject: [PATCH 009/913] =?UTF-8?q?=E5=AF=86=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/trustie/gitlab/manage_user.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/trustie/gitlab/manage_user.rb b/lib/trustie/gitlab/manage_user.rb index a87984490..018859d4c 100644 --- a/lib/trustie/gitlab/manage_user.rb +++ b/lib/trustie/gitlab/manage_user.rb @@ -22,10 +22,10 @@ module Trustie def delete_gitlab_user del_user(self) end - - def change_gitlab_user - change_password(self.gid, self.hashed_password, self.salt) - end + # + #def change_gitlab_user + # change_password(self.gid, self.hashed_password, self.salt) + #end def g @g ||= ::Gitlab.client From 1426557b6d04289c77ff95a93a4f4025fb5b87e3 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 23 Nov 2015 22:10:28 +0800 Subject: [PATCH 010/913] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AF=86=E7=A0=81500?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/trustie/gitlab/manage_user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trustie/gitlab/manage_user.rb b/lib/trustie/gitlab/manage_user.rb index 018859d4c..489dd7b9b 100644 --- a/lib/trustie/gitlab/manage_user.rb +++ b/lib/trustie/gitlab/manage_user.rb @@ -11,7 +11,7 @@ module Trustie base.class_eval { #before_create :add_gitlab_user #before_destroy :delete_gitlab_user - before_save :change_gitlab_user + #before_save :change_gitlab_user } end From 9b033c3adfa8513face966c10e19f65b32de7d8a Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 Nov 2015 10:08:51 +0800 Subject: [PATCH 011/913] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index 95f79b84b..8b018ecd7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -241,6 +241,58 @@ ActiveRecord::Schema.define(:version => 20151120134208) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false From 6b481c8961251585393de5a6941fe5e38358ee5e Mon Sep 17 00:00:00 2001 From: houxiang Date: Tue, 24 Nov 2015 10:12:21 +0800 Subject: [PATCH 012/913] mute the fork function by hx --- app/controllers/repositories_controller.rb | 1 + app/views/repositories/show.html.erb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7f7b24a34..2bd54954a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -315,6 +315,7 @@ update #Modified by young # (show_error_not_found; return) unless @entries g = Gitlab.client + # count = 0 # (0..100).each do |page| # if g.commits(@project.gpid,:page => page).count == 0 diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 7aac3af1d..960455e2e 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,7 +25,8 @@ - +
Fork 0
+
<% if @changesets && !@changesets.empty? %> From b46561dac1fe3c0083b8550980d6aa08d28c9a80 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 Nov 2015 10:34:23 +0800 Subject: [PATCH 013/913] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E8=8B=A5=E4=BD=9C=E5=93=81=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E5=BC=B9=E5=87=BA=E4=BD=9C=E5=93=81=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/edit.html.erb | 13 ++++++++----- app/views/student_work/new.html.erb | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index 517a238b0..d506b5542 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -62,10 +62,13 @@
\ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index fdf1e31a3..4f9999277 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -121,10 +121,13 @@
\ No newline at end of file From ccfbc1e0bdb93425667e9ee776a5ebecc2cf16b1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 24 Nov 2015 12:50:43 +0800 Subject: [PATCH 014/913] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E7=BF=BB=E9=A1=B5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0type=E5=8F=82=E6=95=B0=EF=BC=9B=202.=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=BB=84=E7=BB=87=E8=A1=A8=E4=B8=AD=E5=86=97=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E5=92=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=8A=A8=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_activities.html.erb | 2 +- ...1124032319_delete_useless_org_activities.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151124032319_delete_useless_org_activities.rb diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index aa48fedf1..33ac13e76 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -56,7 +56,7 @@ <% end %> <% if org_act_count == 10 %> -
展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1),:id => "more_org_activities_link",:remote => "true",:class => "none" %>
+
展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1, :type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %>
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end%> diff --git a/db/migrate/20151124032319_delete_useless_org_activities.rb b/db/migrate/20151124032319_delete_useless_org_activities.rb new file mode 100644 index 000000000..705e0dbed --- /dev/null +++ b/db/migrate/20151124032319_delete_useless_org_activities.rb @@ -0,0 +1,18 @@ +class DeleteUselessOrgActivities < ActiveRecord::Migration + def up + OrgActivity.all.each do |act| + if act.container_type == 'Course' + if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 + puts "course" + end + else + if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 + act.destroy + end + end + end + end + + def down + end +end From 269d2f992eecdbbc426c12184622cc2f5a4bf32e Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 24 Nov 2015 15:02:25 +0800 Subject: [PATCH 015/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A1=86=E8=B0=83=E6=95=B4=E5=90=8E=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_organizations.html.erb | 6 +++--- public/stylesheets/new_user.css | 1 + public/stylesheets/org.css | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index 50bb24000..25a0c4508 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -6,11 +6,11 @@
组织列表 - <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> - + <%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + - 搜索 + <% end %>
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index d18dd27d8..fd7c0c4d6 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -384,6 +384,7 @@ a.resourcesGrey:hover {font-size:12px; color:#269ac9;} a.uploadText {color:#ffffff; font-size:14px;} .resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:left; background-color:#ffffff;} .searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;} +.searchResource:focus {border:none;} .searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;} /*.resourcesSearchBanner {height:34px; margin-bottom:10px;}*/ .resourcesSearchBanner {width:710px; height:34px; margin-bottom:10px; margin-top:15px; margin-left:auto; margin-right:auto;} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 914df16b5..daabfc99d 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -37,7 +37,7 @@ a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;} /*项目关联css*/ .relateOrg {width:335px;} .relatedList {width:335px;} -.searchOrg {height:24px; width:200px; color:#9b9b9b9; border:1px solid #15bccf;} +.searchOrg {height:24px; width:200px; color:#9b9b9b; border:1px solid #15bccf;} a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;} a.cancelBtn:hover {background-color:#717171; color:#ffffff;} .relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;} From ec00b86c15a7eae6a02eba1c2519e6088909bc62 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 Nov 2015 15:17:47 +0800 Subject: [PATCH 016/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=A4=9A=E6=AC=A1?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BD=9C=E5=93=81=E6=97=B6=E6=8F=90=E9=86=92?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=B8=8D=E8=83=BD=E9=87=8D=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 10 ++++++-- .../student_work/_has_commit_work.html.erb | 24 +++++++++++++++++++ app/views/student_work/create.js.erb | 10 +++++++- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 app/views/student_work/_has_commit_work.html.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 87d13e169..7eac379e4 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -168,9 +168,15 @@ class StudentWorkController < ApplicationController def create # 提交作品前先判断是否已经提交 + @has_commit = false; if hsd_committed_work?(User.current.id, @homework.id) - flash[:notice] = l(:notice_successful_create) - redirect_to edit_student_work_url(params[:student_work]) + @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first + @has_commit = true; + #flash[:notice] = l(:notice_successful_create) + #redirect_to edit_student_work_url(params[:student_work]) + respond_to do |format| + format.js + end return end if params[:student_work] diff --git a/app/views/student_work/_has_commit_work.html.erb b/app/views/student_work/_has_commit_work.html.erb new file mode 100644 index 000000000..d324f3aaf --- /dev/null +++ b/app/views/student_work/_has_commit_work.html.erb @@ -0,0 +1,24 @@ +
+
+

您已提交过作品,请不要重复提交,如果想修改作品请点击编辑。

+
+ +
+
+ + \ No newline at end of file diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 42b1db8b8..afd8617aa 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,4 +1,12 @@ -<% if @submit_result%> +<% if @has_commit %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); +<% elsif @submit_result%> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); From e89cb99743e1d8fa8984aa68474ac68964b103b3 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 Nov 2015 16:20:29 +0800 Subject: [PATCH 017/913] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E7=BB=93=E6=9E=9C=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 2 +- app/views/exercise/student_exercise_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index d53dc067c..1598030a2 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -328,7 +328,7 @@ class ExerciseController < ApplicationController def student_exercise_list @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? @exercise = Exercise.find params[:id] - @all_exercises = @course.exercises.order("created_at desc") + @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") @exercise_count = @exercise.exercise_users.where('score is not NULL').count if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S")) @exercise_users_list = @exercise.exercise_users.where('score is not NULL') diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 8653836ca..2e51d61af 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -73,7 +73,7 @@
    <% @all_exercises.each_with_index do |exercise,index |%>
  • - <%= link_to "作业#{@all_exercises.count - index}:#{exercise.exercise_name}",''%> + <%= link_to "测验#{@all_exercises.count - index}:#{exercise.exercise_name}",student_exercise_list_exercise_path(exercise.id,:course_id => @course.id)%> <%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
  • <% end%> From 0e7cf4b122c7df17684b1a80b8efd08227453ab2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 Nov 2015 16:21:25 +0800 Subject: [PATCH 018/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=89=B9=E6=AC=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=B7=B2=E5=8F=91=E5=B8=83=E7=9A=84?= =?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/student_work_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 9ad46cd69..3c60fcaed 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -76,7 +76,7 @@ class StudentWorkController < ApplicationController end ################################################################################################################## @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] - @homework_commons = @course.homework_commons.order("created_at desc") + @homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc") @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 @show_all = false From 3a66b1859c716bb9668f6805cb9df1fbadfb2e23 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 24 Nov 2015 16:47:31 +0800 Subject: [PATCH 019/913] =?UTF-8?q?reserved=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4563944c8..ea172b554 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2081,7 +2081,7 @@ zh: label_co_organizer_BHU: 北京航空航天大学 label_co_organizer_CAS: 中国科学院软件研究所 label_co_organizer_InforS: 中创软件 - label_rights_reserved: Copyright 2007~2015, All Rights Riserved + label_rights_reserved: Copyright 2007~2015, All Rights Reserved label_about_us: 关于我们 label_contact_us: 联系我们 label_recruitment_information: 招聘信息 From 85515befc450a1e4ce0f9777c0abb8d466e398a3 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 24 Nov 2015 17:29:57 +0800 Subject: [PATCH 020/913] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E6=95=B0=E5=AD=97=E5=A4=A7=E4=BA=8E0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E5=B0=8F=E4=BA=8E0=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 4 ++ app/views/courses/_tool_expand.html.erb | 60 +++++++++++++++++++++++++ app/views/layouts/base_courses.html.erb | 21 +++++++++ public/javascripts/course.js | 57 +++++++++++++++++++++++ public/stylesheets/courses.css | 11 ++++- 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 app/views/courses/_tool_expand.html.erb diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index caca6fb1e..7c1831d56 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -25,6 +25,10 @@ module CoursesHelper # searchTeacherAndAssistant(project).count end + def show_nav?(count) + count == 0 ? true : false + end + #课程模块需要展示的模块 def course_model @nav_dispaly_course_all_label = 1 diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb new file mode 100644 index 000000000..1f793de90 --- /dev/null +++ b/app/views/courses/_tool_expand.html.erb @@ -0,0 +1,60 @@ +<% course_file_num = visable_attachemnts_incourse(@course).count%> +<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> +<% if show_nav?(@course.course_activities.count) %> + +<% end %> +<% if show_nav?(@course.homework_commons.count) %> + +<% end %> +<% if show_nav?(@course.news.count) %> + +<% end %> +<% if show_nav?(course_file_num) %> + +<% end %> +<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> + +<% end %> +<% if show_nav?(course_feedback_count) %> + +<% end %> +<% if show_nav?(course_poll_count) %> + +<% end %> +<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> + +<% end %> \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 106aa35a7..8b15e67ea 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -136,21 +136,28 @@
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 9f1815695..15968772f 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1306,3 +1306,60 @@ function cancel_org_course_relation(id, courseId){ // alert('<%= @course.id%>') // }) //}) + +//项目点击展开 +function expand_tools_expand(content) { + if (content == "invit") { + $("#expand_tools_expand_invit").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd"); + $("#expand_tools_expand_invit").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt"); + $("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); + } + else { +// $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd"); +// $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt"); +// $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); + $("#navContent").toggle(500); + } + + // 修改数字控制速度, slideUp(500)控制卷起速度 +} + +//通过cookie存储伸开形式 +$(function(){ + var personalized_expand_key = "personalized_expand"; + function personalized_init(){ + var personalized_map = cookieget(personalized_expand_key); + if(personalized_map!=false){ + personalized_map = JSON.parse(personalized_map); + $("*[nhtype='toggle4cookie']").each(function(){ + var personalized_id=$(this).data('id'); + var val = personalized_map[personalized_id]; + if(val!=undefined && val!=$(this).data('val')){ + personalized_click($(this),0); + } + }); + } + } + function personalized_click(obj,timeout){ + var target = $(obj.data('target')); + var oldval = obj.data('val'); + var val=''; + if(oldval=='expand'){val='retract';}else{val='expand';} + obj.data('val',val); + var personalized_map = cookieget(personalized_expand_key); + if(personalized_map == false){ + personalized_map={}; + }else{ + personalized_map = JSON.parse(personalized_map); + } + var personalized_id=obj.data('id'); + personalized_map[personalized_id]=val; + cookiesave(personalized_expand_key,JSON.stringify(personalized_map)); + target.toggle(timeout); + } + $("*[nhtype='toggle4cookie']").on('click',function(){ + personalized_click($(this),500); + }); + + personalized_init(); +}); \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 5ff34a4e1..e71eb975c 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1166,4 +1166,13 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;} .fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;} .mr130 {margin-right:130px;} -.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; } \ No newline at end of file +.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; } + +/*20151123课程排行榜Tim*/ +.courseMenuSetting {background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top:3px; float:right; margin-right:5px;} +.courseMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;} +.rankList {width:220px; padding:10px; background-color:#ffffff; margin-top:10px;} +.rankList li {width:73px; padding:5px 0px; text-align:center; float:left; position:relative;} +.rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;} +.rankPortrait {border-radius:50%; width:35px; height:35px;} +.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; width:65px; color:#585858;} \ No newline at end of file From 2dc31637d862c11911ee26004c0f3d81d978f677 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 24 Nov 2015 17:29:58 +0800 Subject: [PATCH 021/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=92=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E5=8A=A0=E5=85=A5=E7=BB=84=E7=BB=87=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=B7=B2=E7=BB=8F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BA=86=E6=9F=90=E7=BB=84=E7=BB=87=EF=BC=8C=E5=B0=B1=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E9=87=8D=E5=A4=8D=E5=8A=A0=E5=85=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_courses_controller.rb | 4 +++- app/controllers/org_projects_controller.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/org_courses_controller.rb b/app/controllers/org_courses_controller.rb index 3d1d313c5..d054e41de 100644 --- a/app/controllers/org_courses_controller.rb +++ b/app/controllers/org_courses_controller.rb @@ -3,7 +3,9 @@ class OrgCoursesController < ApplicationController org_ids = params[:orgNames] @course = Course.find(params[:course_id]) org_ids.each do |org_id| - OrgCourse.create(:organization_id => org_id.to_i, :course_id => params[:course_id].to_i, :created_at => Time.now) + if OrgCourse.where("organization_id =? and course_id =?", org_id.to_i, params[:course_id].to_i).count == 0 + OrgCourse.create(:organization_id => org_id.to_i, :course_id => params[:course_id].to_i, :created_at => Time.now) + end end respond_to do |format| format.js diff --git a/app/controllers/org_projects_controller.rb b/app/controllers/org_projects_controller.rb index 29e60a62a..a455ce408 100644 --- a/app/controllers/org_projects_controller.rb +++ b/app/controllers/org_projects_controller.rb @@ -3,7 +3,9 @@ class OrgProjectsController < ApplicationController org_ids = params[:orgNames] @project = Project.find(params[:project_id]) org_ids.each do |org_id| - OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now) + if OrgProject.where("organization_id =? and project_id =?", org_id.to_i, @project.id).count == 0 + OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now) + end end respond_to do |format| format.js From 1ae514ca4857d7e2ad53b338731c1e01f899fb4d Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 25 Nov 2015 09:38:13 +0800 Subject: [PATCH 022/913] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E7=9A=84=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=97=A5=E6=9C=9F=E5=92=8C=E6=B5=8B=E9=AA=8C=E6=97=B6?= =?UTF-8?q?=E9=95=BF=E5=81=9A=E6=88=90=E5=8F=AF=E9=80=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 5 +- app/views/exercise/_edit_head.html.erb | 17 +++--- app/views/exercise/_exercise_form.html.erb | 60 +++++++++---------- app/views/exercise/_exercise_teacher.html.erb | 8 ++- app/views/exercise/_show_head.html.erb | 9 ++- public/stylesheets/courses.css | 2 +- 6 files changed, 53 insertions(+), 48 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 1598030a2..6fcbb0c6c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -65,7 +65,6 @@ class ExerciseController < ApplicationController :end_time => "", :publish_time => "", :exercise_description => "", - :show_result => "", :show_result => 1 } @exercise = Exercise.create option @@ -104,10 +103,10 @@ class ExerciseController < ApplicationController def update @exercise.exercise_name = params[:exercise][:exercise_name] @exercise.exercise_description = params[:exercise][:exercise_description] - @exercise.time = params[:exercise][:time] + @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] @exercise.end_time = params[:exercise][:end_time] @exercise.publish_time = params[:exercise][:publish_time] - @exercise.show_result = params[:exercise][:show_result] + @exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result] if @exercise.save respond_to do |format| format.js diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 3090cc2c5..6c357130c 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -6,18 +6,17 @@ <%# if edit_mode %> <%# end %> -
- " > - <%= calendar_for('exercise_publish_time')%> -
- <%# if edit_mode %> - - <%# end %> +
- " > + "/> <%= calendar_for('exercise_end_time')%>
-
测验时长:分钟
+
测验时长:分钟
+ +
+ "/> + <%= calendar_for('exercise_publish_time')%> +
'+ ''+ ' @@ -16,8 +16,10 @@ <% if exercise.exercise_status == 1 %>
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%>
  • +
  • <%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%>
  • <% else%>
  • 编辑
  • +
  • 已发布
  • <% end%> <%# if exercise.exercise_status == 2 %> @@ -31,11 +33,6 @@ <%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %> <%# end%> - - -
  • <%= format_date exercise.created_at.to_date%>
  • - - <% if exercise.exercise_status == 1 %>
  • 发布试卷
  • <% elsif exercise.exercise_status == 2%> @@ -59,5 +56,5 @@ <%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> <%#end%> <% end%> -
  • <%= format_date exercise.created_at.to_date%>
  • +
  • 截止时间:<%= format_time(exercise.end_time.to_s)%>
  • <% end%> \ No newline at end of file diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index f277ebdf5..89964f032 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -10,9 +10,9 @@
    - <% @exercises.each do |exercise|%> + <% @exercises.each_with_index do |exercise,index|%>
      - <%= render :partial => 'exercise', :locals => {:exercise => exercise} %> + <%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
    <% end%> From 5bdcdc607f1424a2e1064db32f3ccbbb34a5f214 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 26 Nov 2015 14:45:35 +0800 Subject: [PATCH 039/913] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise.html.erb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index d7a457047..ba82fbf82 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -12,16 +12,6 @@
    - <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> - - <% if exercise.exercise_status == 1 %> -
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%>
  • -
  • <%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%>
  • - <% else%> -
  • 编辑
  • -
  • 已发布
  • - <% end%> - <%# if exercise.exercise_status == 2 %> <%# else %> @@ -47,6 +37,16 @@
  • <%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%>
  • <% end%> + <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> + + <% if exercise.exercise_status == 1 %> +
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%>
  • +
  • <%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%>
  • + <% else%> +
  • 编辑
  • +
  • 已发布
  • + <% end%> + <% else%> <% if exercise.exercise_status == 2%> <%# if has_commit%> From b602e1c85d82af3774e6c4a6adf45d4d56976cae Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 26 Nov 2015 14:47:52 +0800 Subject: [PATCH 040/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AD=94=E9=A2=98?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E8=AF=95=E5=8D=B7=E6=88=AA?= =?UTF-8?q?=E6=AD=A2=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_student.html.erb | 5 ++++- app/views/exercise/_exercise_student_result.html.erb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index 45d6ccf70..20b8a3d8c 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -42,7 +42,10 @@
    开始时间:<%=format_time(exercise_user.start_at.to_s)%> - 测验时长:<%=exercise.time %>分钟 + 截止时间:<%=format_time(exercise.end_time.to_s)%> + <% unless exercise.time == -1 %> + 测验时长:<%=exercise.time %>分钟 + <% end %> diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index b9306b0d2..8f6ac0e54 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -11,7 +11,10 @@

    <%= exercise.exercise_name%>

    开始时间:<%=format_time(exercise_user.start_at.to_s) %> - 测验时长:<%=exercise.time %>分钟 + 截止时间:<%=format_time(exercise.end_time.to_s)%> + <% unless exercise.time == -1 %> + 测验时长:<%=exercise.time %>分钟 + <% end %> <%# time = exercise_user.end_at - exercise_user.start_at %>
    <%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%>
    From ed9cef486febc212888880a8ec569e72e9298a84 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 26 Nov 2015 15:21:46 +0800 Subject: [PATCH 041/913] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8C=89=E9=92=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 3 +++ app/views/exercise/_exercise.html.erb | 6 +++--- app/views/exercise/index.html.erb | 8 ++++---- app/views/exercise/publish_exercise.js.erb | 2 +- app/views/exercise/republish_exercise.js.erb | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 0b1a035c1..6066ef3d0 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -302,6 +302,7 @@ class ExerciseController < ApplicationController # 发布试卷 def publish_exercise @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save @@ -316,11 +317,13 @@ class ExerciseController < ApplicationController # 重新发布的时候会删除所有的答题 def republish_exercise @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end @exercise.exercise_users.destroy_all @exercise.exercise_status = 1 + @exercise.publish_time = nil @exercise.save respond_to do |format| format.js diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index ba82fbf82..91af83aee 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -8,7 +8,7 @@ <%# else %> <%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> <%# end %> - <%= link_to (index+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> + <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
    @@ -24,9 +24,9 @@ <%# end%> <% if exercise.exercise_status == 1 %> -
  • 发布试卷
  • +
  • 发布试卷
  • <% elsif exercise.exercise_status == 2%> -
  • 取消发布
  • +
  • 取消发布
  • <% else%>
  • 发布试卷
  • <% end%> diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index aacc79950..9b6961e6c 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -5,14 +5,14 @@ $("#homework_page_right").css("min-height",$("#LSide").height()-30); $("#Container").css("width","1000px"); }); - function republish_exercise(exercise_id) + function republish_exercise(exercise_id,index) { $('#ajax-modal').html("
    " + "
    " + "
    " + "

    取消发布后学生答题将会被清空
    是否确定取消发布该测验?

    " + "
    " + - "确  定" + + "确  定" + "取  消" + "
    " + "
    " + @@ -31,7 +31,7 @@ function clickCanel(){hideModal("#popbox02");} - function exercise_submit(exercise_id,exercise_name) + function exercise_submit(exercise_id,exercise_name,index) { if(exercise_name == 0) { @@ -44,7 +44,7 @@ "
    " + "

    测验发布后将不能对测验进行修改,
    是否确定发布该测验?

    " + "
    " + - "确  定" + + "确  定" + "取  消" + "
    " + "
    " + diff --git a/app/views/exercise/publish_exercise.js.erb b/app/views/exercise/publish_exercise.js.erb index ac2899402..c1c4a4fd5 100644 --- a/app/views/exercise/publish_exercise.js.erb +++ b/app/views/exercise/publish_exercise.js.erb @@ -1,4 +1,4 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>"); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','111px'); diff --git a/app/views/exercise/republish_exercise.js.erb b/app/views/exercise/republish_exercise.js.erb index b7172fe9e..2b4e67606 100644 --- a/app/views/exercise/republish_exercise.js.erb +++ b/app/views/exercise/republish_exercise.js.erb @@ -1,4 +1,4 @@ -$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>"); +$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','80px'); From 9c3aed802841b46ff98c25accd2b9e8c6eaf3e54 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 26 Nov 2015 16:29:50 +0800 Subject: [PATCH 042/913] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 36 +++++++ app/views/layouts/base_org.html.erb | 23 +++++ .../organizations/_join_course_menu.html.erb | 98 +++++++++++++++++++ .../organizations/join_course_menu.js.erb | 12 +++ app/views/organizations/search_courses.js.erb | 9 ++ config/routes.rb | 3 + public/stylesheets/new_user.css | 1 + public/stylesheets/org.css | 1 + 8 files changed, 183 insertions(+) create mode 100644 app/views/organizations/_join_course_menu.html.erb create mode 100644 app/views/organizations/join_course_menu.js.erb create mode 100644 app/views/organizations/search_courses.js.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 0d22ab461..4277b5976 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -175,4 +175,40 @@ class OrganizationsController < ApplicationController format.js end end + + def join_course_menu + @organization = Organization.find(params[:id]) + respond_to do |format| + format.js + end + end + + def search_courses + @organization = Organization.find(params[:id]) + condition = '%%' + if !params[:name].nil? + condition = "%#{params[:name].strip}%".gsub(" ","") + end + #sql = "select courses.* from courses inner join members on courses.id = members.course_id inner join org_courses on courses.id = org_courses.course_id where org_courses.organization_id != #{@organization.id} and members.user_id = #{User.current.id} and courses.name like '#{condition}'" + sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'" + user_courses = Course.find_by_sql(sql) + @added_course_ids = @organization.courses.map(&:id) + @courses = [] + user_courses.each do |course| + if @added_course_ids.include?(course.id) + @courses << course + end + end + end + + def join_courses + @organization = Organization.find(params[:id]) + course_ids = params[:courseNames] + course_ids.each do |id| + OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now) + end + respond_to do |format| + format.js + end + end end diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 84edf02e1..7c55060b4 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -98,6 +98,18 @@
    课程 +
    +
      +
    • +
        + +
      • + <%= link_to "加入课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> +
      • +
      +
    • +
    +
    @@ -122,9 +134,20 @@
    + + + + diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb new file mode 100644 index 000000000..36894d92e --- /dev/null +++ b/app/views/organizations/_join_course_menu.html.erb @@ -0,0 +1,98 @@ + + + + + + + + + + + + + +
    +
    +
    请选择关联到组织的课程
    +
    +
    +
    + <%=form_tag url_for(:controller => 'organizations', :action => 'join_courses', :organization_id => organization_id),:method => 'post', :id => 'join_courses_form', :remote => true,:class=>"resourcesSearchBox" do %> + +
    +
    + 关联 +
    + + <% end %> +
    + +
    +
    +
    +
    +
    + + + + diff --git a/app/views/organizations/join_course_menu.js.erb b/app/views/organizations/join_course_menu.js.erb new file mode 100644 index 000000000..95b9f282f --- /dev/null +++ b/app/views/organizations/join_course_menu.js.erb @@ -0,0 +1,12 @@ +$('#topnav_course_menu').hide(); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_course_menu', :locals => {:organization_id => @organization.id}) %>'); +$('#ajax-modal').show(); +//showModal('ajax-modal', '540px'); +//$('#ajax-modal').css('height','390px'); +////$('#ajax-modal').siblings().remove(); +////$('#ajax-modal').siblings().hide(); +//$('#ajax-modal').before("" + +// ""); +//$('#ajax-modal').parent().removeClass("alert_praise"); +//$('#ajax-modal').parent().css("top","").css("left",""); +//$('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/organizations/search_courses.js.erb b/app/views/organizations/search_courses.js.erb new file mode 100644 index 000000000..9e92b4b07 --- /dev/null +++ b/app/views/organizations/search_courses.js.erb @@ -0,0 +1,9 @@ +$("#search_courses_result_list").html(""); +$("#search_courses_result_list").append('
      '); + +<% @courses.each do |course|%> +link = "
    • "; +$("#search_courses_result_list").append(link ); +<%end %> +$("#search_courses_result_list").append('
    ') + diff --git a/config/routes.rb b/config/routes.rb index d137553ad..f8f0e1cc1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,9 @@ RedmineApp::Application.routes.draw do get 'members' get 'more_org_projects' get 'more_org_courses' + get 'search_courses' + post 'join_course_menu' + post 'join_courses' end collection do get 'check_uniq' diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index d18dd27d8..bedfa1ceb 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -384,6 +384,7 @@ a.resourcesGrey:hover {font-size:12px; color:#269ac9;} a.uploadText {color:#ffffff; font-size:14px;} .resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:left; background-color:#ffffff;} .searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;} +.searchCourse {border:none; outline:none; background-color:#ffffff; width:184px; padding-left:10px; display:block; margin-bottom:15px;} .searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;} /*.resourcesSearchBanner {height:34px; margin-bottom:10px;}*/ .resourcesSearchBanner {width:710px; height:34px; margin-bottom:10px; margin-top:15px; margin-left:auto; margin-right:auto;} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 914df16b5..0a578ccc3 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -44,6 +44,7 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;} .relatedListName {width:240px; text-align:left; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;} .relatedListOption {width:80px; text-align:center;} .relateOrgName {width:240px; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;} +.search_org {width:150px; max-width:200px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;} /*组织列表*/ .mt28 {margin-top:28px;} From dcd441a9db79c7a2fef1bf4a6d50abb8054ee1b1 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Nov 2015 16:43:10 +0800 Subject: [PATCH 043/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 9 ++++++--- app/models/attachment.rb | 9 ++++++++- app/models/board.rb | 2 +- app/models/course.rb | 11 +++++++++-- app/models/document.rb | 2 +- app/models/issue.rb | 2 +- app/models/journals_for_message.rb | 3 ++- app/models/message.rb | 2 +- app/models/news.rb | 2 +- app/models/project.rb | 11 +++++++++-- app/models/project_tags.rb | 2 +- app/models/user.rb | 9 ++++++++- config/application.rb | 3 ++- 13 files changed, 50 insertions(+), 17 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 4b75a3297..815a44839 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -160,7 +160,8 @@ class WelcomeController < ApplicationController multi_match: { query: @name, type:"most_fields", - fields: ['login^5', 'firstname','lastname','name^5','description','filename^5'] + operator: "or", + fields: ['login', 'firstname','lastname','name','description^0.5','filename'] } }, highlight: { @@ -190,7 +191,8 @@ class WelcomeController < ApplicationController multi_match: { query: @name, type:"most_fields", - fields: ['login^5', 'firstname','lastname','name^5','description','filename^5'] + operator: "or", + fields: ['login', 'firstname','lastname','name','description^0.5','filename'] } }, highlight: { @@ -219,7 +221,8 @@ class WelcomeController < ApplicationController multi_match: { query: @name, type:"most_fields", - fields: ['login^5', 'firstname','lastname','name^5','description','filename^5'] + operator: "or", + fields: ['login', 'firstname','lastname','name','description^0.5','filename'] } }, highlight: { diff --git a/app/models/attachment.rb b/app/models/attachment.rb index a98111b4f..3cb2d9057 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -46,6 +46,7 @@ class Attachment < ActiveRecord::Base settings index: { number_of_shards: 1 } do mappings dynamic: 'false' do indexes :filename, analyzer: 'smartcn',index_options: 'offsets' + indexes :downloads, analyzer: 'smartcn',index_options: 'offsets' end end @@ -109,9 +110,15 @@ class Attachment < ActiveRecord::Base query: { multi_match: { query: query, + type:"most_fields", + operator: "or", fields: ['filename'] } }, + sort:{ + downloads: {order:"desc"}, + _score:{order:"desc"} + }, highlight: { pre_tags: [''], post_tags: [''], @@ -625,4 +632,4 @@ end #暂时只做公开课程/项目里的公开资源 和其他的公开资源 Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' + 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+ - 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import + 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true diff --git a/app/models/board.rb b/app/models/board.rb index edcbe0c9d..35a7a72d1 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -17,7 +17,7 @@ class Board < ActiveRecord::Base include Redmine::SafeAttributes - belongs_to :project + belongs_to :project,:touch => true belongs_to :course has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC" diff --git a/app/models/course.rb b/app/models/course.rb index 1991c00cb..71cd74633 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -16,6 +16,7 @@ class Course < ActiveRecord::Base mappings dynamic: 'false' do indexes :name, analyzer: 'smartcn',index_options: 'offsets' indexes :description, analyzer: 'smartcn',index_options: 'offsets' + indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets' end end @@ -115,9 +116,15 @@ class Course < ActiveRecord::Base query: { multi_match: { query: query, - fields: ['name', 'description'] + type:"most_fields", + operator: "or", + fields: ['name', 'description^0.5'] } }, + sort: { + updated_at:{order:"desc"}, + _score:{order: "desc" } + }, highlight: { pre_tags: [''], post_tags: [''], @@ -405,6 +412,6 @@ end # body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash } # Index all article records from the DB to Elasticsearch -Course.import +Course.where('is_public = 1').import :force=>true diff --git a/app/models/document.rb b/app/models/document.rb index 37983d6d4..b45a74775 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -17,7 +17,7 @@ class Document < ActiveRecord::Base include Redmine::SafeAttributes - belongs_to :project + belongs_to :project,:touch=>true belongs_to :user belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" include UserScoreHelper diff --git a/app/models/issue.rb b/app/models/issue.rb index 2a6da44c5..edce3310a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base include Redmine::SafeAttributes include Redmine::Utils::DateCalculation include UserScoreHelper - belongs_to :project + belongs_to :project,:touch=> true belongs_to :tracker belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 5e40267cb..14760a631 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -21,7 +21,8 @@ class JournalsForMessage < ActiveRecord::Base after_destroy :delete_kindeditor_assets belongs_to :project, :foreign_key => 'jour_id', - :conditions => "#{self.table_name}.jour_type = 'Project' " + :conditions => "#{self.table_name}.jour_type = 'Project' ",:touch => true + belongs_to :course, :foreign_key => 'jour_id' diff --git a/app/models/message.rb b/app/models/message.rb index 7af59815b..c5371097a 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -20,7 +20,7 @@ class Message < ActiveRecord::Base include UserScoreHelper include ApplicationHelper has_many_kindeditor_assets :assets, :dependent => :destroy - belongs_to :board + belongs_to :board,:touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :praise_tread, as: :praise_tread_object, dependent: :destroy diff --git a/app/models/news.rb b/app/models/news.rb index e9b8b5314..aa5d6df1f 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -17,7 +17,7 @@ class News < ActiveRecord::Base include Redmine::SafeAttributes - belongs_to :project + belongs_to :project,:touch => true include ApplicationHelper has_many_kindeditor_assets :assets, :dependent => :destroy #added by nwb diff --git a/app/models/project.rb b/app/models/project.rb index 53e909776..92e6a4d0b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -39,6 +39,7 @@ class Project < ActiveRecord::Base mappings dynamic: 'false' do indexes :name, analyzer: 'smartcn',index_options: 'offsets' indexes :description, analyzer: 'smartcn',index_options: 'offsets' + indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets' end end @@ -192,9 +193,15 @@ class Project < ActiveRecord::Base query: { multi_match: { query: query, - fields: ['name','description'] + type:"most_fields", + operator: "and", + fields: ['name','description^0.5'] } }, + sort: { + updated_on:{order: "desc" }, + _score:{order: "desc" } + }, highlight: { pre_tags: [''], post_tags: [''], @@ -1222,5 +1229,5 @@ class Project < ActiveRecord::Base end -Project.import +Project.where('is_public = 1').import :force=>true diff --git a/app/models/project_tags.rb b/app/models/project_tags.rb index 16de1ea45..bcf666fb5 100644 --- a/app/models/project_tags.rb +++ b/app/models/project_tags.rb @@ -2,7 +2,7 @@ class ProjectTags < ActiveRecord::Base attr_accessible :description, :project_id, :tag_id, :user_id ####################################################################################################添加代码 - belongs_to :project + belongs_to :project,:touch => true belongs_to :tag belongs_to :user diff --git a/app/models/user.rb b/app/models/user.rb index 3818e5d47..fc18313a0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,6 +35,7 @@ class User < Principal indexes :login, analyzer: 'smartcn',index_options: 'offsets' indexes :firstname, analyzer: 'smartcn',index_options: 'offsets' indexes :lastname, analyzer: 'smartcn',index_options: 'offsets' + indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets' end end @@ -271,9 +272,15 @@ class User < Principal query: { multi_match: { query: query, + type:"most_fields", + operator: "or", fields: ['login', 'firstname','lastname'] } }, + sort:{ + last_login_on: {order:"desc"}, + _score:{order:"desc"} + }, highlight: { pre_tags: [''], post_tags: [''], @@ -1208,4 +1215,4 @@ end # Index all article records from the DB to Elasticsearch # 匿名用户 角色 和 管理员角色不能被索引 -User.where('id not in (2,4)').import +User.where('id not in (2,4)').import :force=>true diff --git a/config/application.rb b/config/application.rb index 6e4a2983a..14793fcac 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' require 'sprockets/railtie' - +require 'elasticsearch/model' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) @@ -73,6 +73,7 @@ module RedmineApp end config.after_initialize do + Elasticsearch::Client.new hosts: ['localhost:9200', 'localhost:9201'], retry_on_failure: true,log:true end if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) From f8621cac76b3e00baeadc30843019d54723373cf Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 26 Nov 2015 16:57:51 +0800 Subject: [PATCH 044/913] =?UTF-8?q?=E6=9C=AA=E8=AE=BE=E7=BD=AE=E8=80=83?= =?UTF-8?q?=E8=AF=95=E6=97=B6=E9=95=BF=E6=97=B6=EF=BC=8C=E5=8F=AA=E8=A6=81?= =?UTF-8?q?=E8=BF=98=E6=9C=AA=E5=88=B0=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=B0=B1=E5=8F=AF=E4=BB=A5=E4=B8=80=E7=9B=B4=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E8=AF=95=E5=8D=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 19 ++++++++++----- app/views/exercise/_commit_alert.html.erb | 5 +++- app/views/exercise/_exercise.html.erb | 2 +- app/views/exercise/_exercise_form.html.erb | 6 ++--- app/views/exercise/_exercise_student.html.erb | 23 ++++++++++++------- .../_exercise_student_result.html.erb | 10 ++++---- app/views/exercise/_exercise_teacher.html.erb | 4 ++-- app/views/exercise/_show_head.html.erb | 4 ++-- app/views/exercise/commit_exercise.js.erb | 2 +- public/stylesheets/courses.css | 1 + 10 files changed, 47 insertions(+), 29 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6066ef3d0..d4050da18 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -34,17 +34,24 @@ class ExerciseController < ApplicationController render_403 return end - @can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)) || User.current.admin? + exercise_end = Time.parse(format_time(@exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") + if @exercise.time == -1 + @can_edit_excercise = exercise_end + else + @can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end) || User.current.admin? + end @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first # 学生点击的时候即创建关联,自动保存 #eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) # 已提交问卷的用户不能再访问该界面 +=begin if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?) respond_to do |format| format.html {render :layout => 'base_courses'} end else +=end if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id) eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first @@ -55,7 +62,7 @@ class ExerciseController < ApplicationController respond_to do |format| format.html {render :layout => 'base_courses'} end - end + #end end def new @@ -82,7 +89,7 @@ class ExerciseController < ApplicationController exercise ||= Exercise.new exercise.exercise_name = params[:exercise][:exercise_name] exercise.exercise_description = params[:exercise][:exercise_description] - exercise.end_time = params[:exercise][:end_time] + exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) exercise.publish_time = params[:exercise][:publish_time] exercise.user_id = User.current.id exercise.time = params[:exercise][:time] @@ -107,7 +114,7 @@ class ExerciseController < ApplicationController @exercise.exercise_name = params[:exercise][:exercise_name] @exercise.exercise_description = params[:exercise][:exercise_description] @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] - @exercise.end_time = params[:exercise][:end_time] + @exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) @exercise.publish_time = params[:exercise][:publish_time] @exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result] if @exercise.save @@ -351,8 +358,8 @@ class ExerciseController < ApplicationController # 学生提交答卷,选中答案的过程中提交 def commit_answer eq = ExerciseQuestion.find(params[:exercise_question_id]) - # 已提交过的则不允许答题 - if has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) + # 已提交过的且是限时的则不允许答题 + if has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1 render :json => {:text => "failure"} return end diff --git a/app/views/exercise/_commit_alert.html.erb b/app/views/exercise/_commit_alert.html.erb index d92ca51fb..a21dbd2a7 100644 --- a/app/views/exercise/_commit_alert.html.erb +++ b/app/views/exercise/_commit_alert.html.erb @@ -1,7 +1,10 @@
    - <% if status == 0 %> + <% if status == 0 && exercise.time != -1 %>

    提交成功!您的分数是:<%=@score %>分。

    <%= link_to "确定", exercise_path(),:class => 'commit'%> + <% elsif status == 0 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") %> +

    提交成功!

    + <%= link_to "确定", exercise_index_path(:course_id => @course.id),:class => 'commit'%> <% elsif status == 1 %>

    您还有尚未作答的题目请完成后再提交!

    <%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%> diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index 91af83aee..db412672c 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -53,7 +53,7 @@ <%#else%> - <%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> + <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> <%#end%> <% end%>
  • 截止时间:<%= format_time(exercise.end_time.to_s)%>
  • diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 8de4dac38..e283f8b0c 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -136,14 +136,14 @@ alert("测验标题不能为空"); } else if($.trim($("#exercise_end_time").val()) =="") { alert("截止时间不能为空"); - } else if(Date.parse($("#exercise_end_time").val()) < Date.now()) { + } else if((Date.parse($("#exercise_end_time").val())+(24*60*60-1)*1000) < Date.now()) { alert("截止时间不能小于当前时间"); } else if($.trim($("#exercise_time").val()) !="" && !/^[1-9][0-9]*$/.test($.trim($("#exercise_time").val()))) { alert("测验时长必须为非零开头的数字"); } else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_publish_time").val()) < Date.now()) { alert("发布时间不能小于当前时间"); - } else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_end_time").val()) <= Date.parse($("#exercise_publish_time").val())) { - alert("截止时间必须大于发布时间"); + } else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_end_time").val()) < Date.parse($("#exercise_publish_time").val())) { + alert("截止时间不能小于发布时间"); } else { doc.parent().parent().parent().submit(); } diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index 20b8a3d8c..7010407ce 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -3,6 +3,8 @@ $("#RSide").removeAttr("id"); $("#homework_page_right").css("min-height",$("#LSide").height()-30); $("#Container").css("width","1000px"); + end_time = <%=exercise.end_time.to_i%> + getTime(end_time); /*start_time = new Date(); start_time.setFullYear(<%#=exercise_user.start_at.year%>); start_time.setMonth(<%#=exercise_user.start_at.month%>); @@ -17,11 +19,16 @@ function getTime(end_time) { //alert(end_time); now = new Date(); - var total_seconds = (now.getTime() - end_time)/1000; + var total_seconds = now.getTime()/1000 - end_time; + if (total_seconds < 0) { + $("#exercise_submit_btn").click(); + return; + } + setTimeout("getTime("+end_time+");", 1000); //start = new Date(start_time); //end_time = start_time; //var total_seconds = total_seconds - 1; - var hours = total_seconds / 60 / 60; + /*var hours = total_seconds / 60 / 60; var hoursRound = Math.floor(hours); var minutes = total_seconds /60 - (60 * hoursRound); var minutesRound = Math.floor(minutes); @@ -29,9 +36,9 @@ var secondsRound = Math.round(seconds); $("#rest_hours").html(hoursRound); $("#rest_minutes").html(minutesRound); - $("#rest_seconds").html(secondsRound); + $("#rest_seconds").html(secondsRound);*/ //if(total_seconds >0) { - setTimeout("getTime("+end_time+");", 1000); + //setTimeout("getTime("+end_time+");", 1000); //} } @@ -41,8 +48,8 @@

    <%= exercise.exercise_name%>

    - 开始时间:<%=format_time(exercise_user.start_at.to_s)%> - 截止时间:<%=format_time(exercise.end_time.to_s)%> + 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S")%> + 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> <% unless exercise.time == -1 %> 测验时长:<%=exercise.time %>分钟 <% end %> @@ -194,7 +201,7 @@ } - > + >
    @@ -202,7 +209,7 @@ <% end %>
    - <%= link_to l(:button_submit),commit_exercise_exercise_path(exercise), :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %> + <%= link_to l(:button_submit),commit_exercise_exercise_path(exercise),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
    diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 8f6ac0e54..3445d6986 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -10,8 +10,8 @@

    <%= exercise.exercise_name%>

    - 开始时间:<%=format_time(exercise_user.start_at.to_s) %> - 截止时间:<%=format_time(exercise.end_time.to_s)%> + 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S") %> + 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> <% unless exercise.time == -1 %> 测验时长:<%=exercise.time %>分钟 <% end %> @@ -34,7 +34,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %> + <% if !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %> √ <% else %> × @@ -73,7 +73,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %> + <% if !standard_answer.empty? && get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %> √ <% else %> × @@ -112,7 +112,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if standard_answer.include?(answer.first.answer_text) %> + <% if !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) %> √ <% else %> × diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 0a96b782b..6e00fc41d 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -11,9 +11,9 @@

    <%= exercise.exercise_name%>

    <% unless exercise.publish_time.nil? %> - 发布时间:<%=format_time(exercise.publish_time.to_s) %> + 发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") %> <% end %> - 截止时间:<%=format_time(exercise.end_time.to_s) %> + 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") %> <% if exercise.time != -1 %> 测验时长:<%=exercise.time %>分钟 <% end %> diff --git a/app/views/exercise/_show_head.html.erb b/app/views/exercise/_show_head.html.erb index 16a572583..f385e58b8 100644 --- a/app/views/exercise/_show_head.html.erb +++ b/app/views/exercise/_show_head.html.erb @@ -4,9 +4,9 @@

    <%= exercise.exercise_name%>

    <% unless exercise.publish_time.nil? %> - 发布时间:<%=Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%> + 发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%> <% end %> - 截止时间:<%=Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %> + 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %> <% if exercise.time != -1 %> 测验时长:<%= exercise.time %>分钟 <% end %> diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index 2a40df2a5..5ede8a951 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1,4 +1,4 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); showModal('ajax-modal', '270px'); $('#ajax-modal').css('height','110px'); $('#ajax-modal').siblings().remove(); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b7a742994..17ed37e05 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1166,4 +1166,5 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;} .fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;} .mr130 {margin-right:130px;} +.mr100 {margin-right:100px;} .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; } \ No newline at end of file From dec5980443be5de596bf04892dcc57908afd8593 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 26 Nov 2015 17:20:17 +0800 Subject: [PATCH 045/913] =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=B8=80=E5=88=B0=E7=AB=8B=E5=8D=B3=E6=8F=90=E4=BA=A4=E8=AF=95?= =?UTF-8?q?=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_commit_alert.html.erb | 7 +++++-- app/views/exercise/_exercise_student.html.erb | 2 +- app/views/exercise/_exercise_student_result.html.erb | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/views/exercise/_commit_alert.html.erb b/app/views/exercise/_commit_alert.html.erb index a21dbd2a7..23aee5a90 100644 --- a/app/views/exercise/_commit_alert.html.erb +++ b/app/views/exercise/_commit_alert.html.erb @@ -1,5 +1,5 @@
    - <% if status == 0 && exercise.time != -1 %> + <% if status == 0 && exercise.time != -1%>

    提交成功!您的分数是:<%=@score %>分。

    <%= link_to "确定", exercise_path(),:class => 'commit'%> <% elsif status == 0 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") %> @@ -8,8 +8,11 @@ <% elsif status == 1 %>

    您还有尚未作答的题目请完成后再提交!

    <%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%> - <% else %> + <% elsif status == 2 %>

    发生未知错误,请检查您的网络。

    <%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%> + <% else %> +

    时间已到!您的分数是:<%=@score %>分。

    + <%= link_to "确定", exercise_path(),:class => 'commit'%> <% end %>
    diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index 7010407ce..a5c0f2a46 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -20,7 +20,7 @@ //alert(end_time); now = new Date(); var total_seconds = now.getTime()/1000 - end_time; - if (total_seconds < 0) { + if (total_seconds > 0) { $("#exercise_submit_btn").click(); return; } diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 3445d6986..93e52b0a1 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -39,7 +39,7 @@ <% else %> × <% end %>
    - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
    @@ -117,7 +117,7 @@ <% else %> × <% end %>
    - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
    From aca7684414ca58150cad002f2d00532ecf5ff75c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 26 Nov 2015 18:22:03 +0800 Subject: [PATCH 046/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=20=E5=90=84=E6=A8=A1=E5=9D=97=E5=8A=A8=E4=BD=9C=20?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=8A=A0=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 40 +++++++++++++++++++ app/models/attachment.rb | 16 +++++++- app/models/comment.rb | 13 +++++- app/models/journals_for_message.rb | 10 ++++- app/models/message.rb | 14 ++++++- ...1125072235_add_course_contributor_score.rb | 30 ++++++++++++++ db/schema.rb | 2 +- lib/trustie/gitlab/manage_member.rb | 3 ++ 8 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20151125072235_add_course_contributor_score.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f4e0f88ff..a65ed639c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,6 +75,46 @@ module ApplicationHelper end end + # 更新课程英雄榜得分 + # user传过来必须是学生 + def course_member_score(course_id,user_id,type) + course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first + case type + when "JournalForMessage" + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, + :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0) + else + score = course_contributor_score.journal_num + 1 + course_contributor_score.update_attributes(:journal_num => score) + end + when "Message" + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0, + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + else + score = course_contributor_score.message_num + 2 + course_contributor_score.update_attributes(:message_num => score) + end + when "MessageReply" + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1, + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + else + score = course_contributor_score.message_reply_num + 1 + course_contributor_score.update_attributes(:message_reply_num => score) + end + when "NewReply" + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, + :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + else + score = course_contributor_score.news_reply_num + 1 + course_contributor_score.update_attributes(:news_reply_num => score) + end + end + end + # Added by young # Define the course menu's link class # 不是数组的转化成数组,然后判断当前menu_item是否在给定的列表 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f7fb9b1aa..22be5a42f 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -74,7 +74,7 @@ class Attachment < ActiveRecord::Base @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") before_save :files_to_final_location,:act_as_course_activity - after_create :office_conver, :be_user_score,:act_as_forge_activity + after_create :office_conver, :be_user_score,:act_as_forge_activity, :act_as_student_score after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score @@ -560,4 +560,18 @@ class Attachment < ActiveRecord::Base self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id) end end + + # 课程成员得分(英雄榜) + def act_as_student_score + unless self.author.allowed_to?(:as_teacher, self.course) + if self.parent_id.nil? + # 发帖 + course_member_score(self.course.id, self.author_id, "Message") + else + # 回帖 + course_member_score(self.course.id, self.author_id, "MessageReply") + end + end + end + end diff --git a/app/models/comment.rb b/app/models/comment.rb index bb31eb894..9de25c50d 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -35,7 +35,7 @@ class Comment < ActiveRecord::Base belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' validates_presence_of :commented, :author, :comments safe_attributes 'comments' - after_create :send_mail, :act_as_system_message + after_create :send_mail, :act_as_system_message, :act_as_student_score def act_as_system_message if self.commented.course @@ -66,13 +66,24 @@ class Comment < ActiveRecord::Base def set_notify_id(notify_id) @notify_id= notify_id end + def get_notify_id() return @notify_id end + def set_notify_is_read(notify_is_read) @notify_is_read = notify_is_read end + def get_notify_is_read() return @notify_is_read end + + # 课程成员得分(英雄榜) + def act_as_student_score + unless self.author.allowed_to?(:as_teacher, self.commented.course) + course_member_score(self.commented.course.id, self.author_id, "NewReply") + end + end + end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 5e40267cb..eaece95ce 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -64,7 +64,7 @@ class JournalsForMessage < ActiveRecord::Base has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message, :act_as_principal_activity + after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -263,4 +263,12 @@ class JournalsForMessage < ActiveRecord::Base end end + + # 课程成员得分(英雄榜) + def act_as_student_score + unless self.user.allowed_to?(:as_teacher, self.jour) + course_member_score(self.jour_id, self.user_id, "JournalForMessage") + end + end + end diff --git a/app/models/message.rb b/app/models/message.rb index 7af59815b..21e5e1c71 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -74,7 +74,7 @@ class Message < ActiveRecord::Base after_update :update_messages_board after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets - after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score #before_save :be_user_score scope :visible, lambda {|*args| @@ -285,4 +285,16 @@ class Message < ActiveRecord::Base delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE end + # 课程成员得分(英雄榜) + def act_as_student_score + unless self.author.allowed_to?(:as_teacher, self.course) + if self.parent_id.nil? + # 发帖 + course_member_score(self.course.id, self.author_id, "Message") + else + # 回帖 + course_member_score(self.course.id, self.author_id, "MessageReply") + end + end + end end diff --git a/db/migrate/20151125072235_add_course_contributor_score.rb b/db/migrate/20151125072235_add_course_contributor_score.rb new file mode 100644 index 000000000..c3b7c3793 --- /dev/null +++ b/db/migrate/20151125072235_add_course_contributor_score.rb @@ -0,0 +1,30 @@ +class AddCourseContributorScore < ActiveRecord::Migration + def up + # course_count = Course.all.count / 30 + 1 + # transaction do + # for i in 1 ... course_count do i + Course.all.each do |course| + if course.course_activities.count > 1 + course.student.each do |s| + puts course.id + puts course.name + puts s.student_id + board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2 + message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null;").count * 1 + common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1 + attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5 + journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1 + # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1 + # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1 + CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count, + :news_reply_num => common_reply_count, :resource_num => attachment_count, :journal_num => journal_count, :journal_reply_num => 0) + end + end + end + # end + # end + end + + def down + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 64f94cc29..51ac1ad7d 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 => 20151125064914) do +ActiveRecord::Schema.define(:version => 20151125072235) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false diff --git a/lib/trustie/gitlab/manage_member.rb b/lib/trustie/gitlab/manage_member.rb index b8c2149f4..627c137ce 100644 --- a/lib/trustie/gitlab/manage_member.rb +++ b/lib/trustie/gitlab/manage_member.rb @@ -23,6 +23,9 @@ module Trustie def add_gitlab_member if isGitlabProject? @g ||= ::Gitlab.client + if self.member.user.gid.nil? + add_user(self.member.user) + end @g.add_team_member(project.gpid, self.member.user.gid, self.role.to_gitlab_role ) end end From 061a1f602a2212891634d819623d4db8d06497bb Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 26 Nov 2015 21:17:04 +0800 Subject: [PATCH 047/913] =?UTF-8?q?=E6=95=88=E6=9E=9C=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 22 +++++--- app/models/attachment.rb | 18 +++--- app/views/courses/_tool_expand.html.erb | 27 +++------ app/views/layouts/base_courses.html.erb | 74 ++++++++++++------------- 4 files changed, 66 insertions(+), 75 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index d07001215..aa42d247e 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -737,11 +737,10 @@ module CoursesHelper end desc.html_safe end -end -# 学生按作业总分排序,取前8个 -def hero_homework_score(course, score_sort_by) - sql_select = "SELECT members.*,( + # 学生按作业总分排序,取前8个 + def hero_homework_score(course, score_sort_by) + sql_select = "SELECT members.*,( SELECT SUM(student_works.final_score) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id @@ -752,8 +751,15 @@ def hero_homework_score(course, score_sort_by) JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9" - sql = ActiveRecord::Base.connection() - homework_scores = Member.find_by_sql(sql_select) - sql.close() - homework_scores + sql = ActiveRecord::Base.connection() + homework_scores = Member.find_by_sql(sql_select) + sql.close() + homework_scores + end + + def contributor_course_scor(course) + + end + end + diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 22be5a42f..45d19e681 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,10 +73,11 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location,:act_as_course_activity - after_create :office_conver, :be_user_score,:act_as_forge_activity, :act_as_student_score + before_save :files_to_final_location,:act_as_course_activity, :act_as_student_score + after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score + # after_save :act_as_student_score # add by nwb # 获取所有可公开的资源文件列表 @@ -563,13 +564,14 @@ class Attachment < ActiveRecord::Base # 课程成员得分(英雄榜) def act_as_student_score - unless self.author.allowed_to?(:as_teacher, self.course) - if self.parent_id.nil? - # 发帖 - course_member_score(self.course.id, self.author_id, "Message") + unless self.author.allowed_to?(:as_teacher, self.container) + course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", self.container_id, self.author_id).first + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => self.container_id, :user_id => self.author_id, :message_num => 0, :message_reply_num => 0, + :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0) else - # 回帖 - course_member_score(self.course.id, self.author_id, "MessageReply") + score = course_contributor_score.news_reply_num + 5 + course_contributor_score.update_attributes(:resource_num => score) end end end diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index 1f793de90..01454c8a8 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -1,60 +1,47 @@ <% course_file_num = visable_attachemnts_incourse(@course).count%> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% if show_nav?(@course.course_activities.count) %> - -<% end %> <% if show_nav?(@course.homework_commons.count) %> <% end %> <% if show_nav?(@course.news.count) %> <% end %> <% if show_nav?(course_file_num) %> <% end %> <% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% end %> <% if show_nav?(course_feedback_count) %> <% end %> <% if show_nav?(course_poll_count) %> <% end %> <% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 4a7692405..c214145cc 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -147,14 +147,14 @@ <% end %> <% unless show_nav?(@course.news.count) %> <% end %> <% unless show_nav?(course_file_num) %> @@ -163,7 +163,7 @@ <%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %> <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %> - +上传资源 + <% end %>
    <% end %> @@ -171,27 +171,28 @@ <% end %> <% unless show_nav?(course_feedback_count) %> <% end %> <% unless show_nav?(course_poll_count) %> <% end %> <% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> <% end %> <%# 工具栏展开 %> @@ -204,40 +205,25 @@
      @@ -350,6 +336,16 @@ $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox_polls"); } +// 鼠标经过的时候显示内容 + function message_titile_show(obj,e) + { + obj.parent().parent().next("div").show(); + obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute"); + } + function message_titile_hide(obj) + { + obj.parent().parent().next("div").hide(); + } From 8c83bbfff382bc243f443a13b2ec6dc2ec769ec8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 00:48:08 +0800 Subject: [PATCH 048/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 4 +- app/views/courses/_tool_expand.html.erb | 92 ++++++------- app/views/layouts/base_courses.html.erb | 4 +- ...1125072235_add_course_contributor_score.rb | 64 +++++---- ...total_score_to_course_contributor_score.rb | 5 + db/schema.rb | 3 +- lib/trustie/gitlab/manage_member.rb | 126 +++++++++--------- 7 files changed, 155 insertions(+), 143 deletions(-) create mode 100644 db/migrate/20151126160252_add_total_score_to_course_contributor_score.rb diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index aa42d247e..022d86d9b 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -757,8 +757,8 @@ module CoursesHelper homework_scores end - def contributor_course_scor(course) - + def contributor_course_scor(course_id) + ccs = CourseContributorScore.where("course_id =?", course_id).limit(9) end end diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index 01454c8a8..cec5311c6 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -1,47 +1,47 @@ -<% course_file_num = visable_attachemnts_incourse(@course).count%> -<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% if show_nav?(@course.homework_commons.count) %> - -<% end %> -<% if show_nav?(@course.news.count) %> - -<% end %> -<% if show_nav?(course_file_num) %> - -<% end %> -<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> - -<% end %> -<% if show_nav?(course_feedback_count) %> - -<% end %> -<% if show_nav?(course_poll_count) %> - -<% end %> -<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> - +<% course_file_num = visable_attachemnts_incourse(@course).count%> +<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> +<% if show_nav?(@course.homework_commons.count) %> + +<% end %> +<% if show_nav?(@course.news.count) %> + +<% end %> +<% if show_nav?(course_file_num) %> + +<% end %> +<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> + +<% end %> +<% if show_nav?(course_feedback_count) %> + +<% end %> +<% if show_nav?(course_poll_count) %> + +<% end %> +<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> + <% end %> \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index c214145cc..604bf2601 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -205,7 +205,7 @@

        课程贡献榜

        - <% hero_homework_score(@course, "desc").each do |student_score| %> + <% contributor_course_scor(@course.id).each do |student_score| %>
      • <%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %>

        <%=link_to student_score.user, user_path(student_score.user) %>

        @@ -213,7 +213,7 @@ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> - <%= student_score.score.to_i %>

        + <%= student_score.total_score.to_i %>

        - <%= link_to l(:button_submit),commit_exercise_exercise_path(exercise),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %> + <%= link_to "保存",commit_exercise_exercise_path(exercise),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
        diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 6e00fc41d..24687d28b 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -96,7 +96,7 @@
        第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分)
        - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first%>
        From 7cb39d1754d500d95eb9cab6a019634a11c01833 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 10:40:58 +0800 Subject: [PATCH 052/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 9 ++++++--- app/models/course.rb | 4 ++-- app/models/project.rb | 4 ++-- app/models/user.rb | 4 ++-- lib/tasks/elasticsearch.rake | 1 + 5 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 lib/tasks/elasticsearch.rake diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3cb2d9057..dea4e404e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -104,6 +104,9 @@ class Attachment < ActiveRecord::Base " LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" + " LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id) } + scope :indexable,lambda { where('is_public = 1 and ((container_type in ("Principal")) ' + + 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+ + 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')')} #用于elastic建索引的scope def self.search(query) __elasticsearch__.search( { @@ -630,6 +633,6 @@ end # Index all article records from the DB to Elasticsearch #暂时只做公开课程/项目里的公开资源 和其他的公开资源 -Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' + - 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+ - 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true +#Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' + +# 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+ +# 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true diff --git a/app/models/course.rb b/app/models/course.rb index e73257033..8f7c990ab 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -109,7 +109,7 @@ class Course < ActiveRecord::Base where(" LOWER(name) LIKE :p ", :p => pattern) end } - + scope :indexable,lambda { where('is_public = 1') } def self.search(query) __elasticsearch__.search( { @@ -412,6 +412,6 @@ end # body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash } # Index all article records from the DB to Elasticsearch -Course.where('is_public = 1').import :force=>true +#Course.where('is_public = 1').import :force=>true diff --git a/app/models/project.rb b/app/models/project.rb index 0453f1164..034873596 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -186,7 +186,7 @@ class Project < ActiveRecord::Base } scope :project_entities, -> { where(project_type: ProjectType_project) } scope :course_entities, -> { where(project_type: ProjectType_course) } - + scope :indexable,lambda { where('is_public = 1')} #用于elastic建索引的scope def self.search(query) __elasticsearch__.search( { @@ -1235,5 +1235,5 @@ class Project < ActiveRecord::Base end -Project.where('is_public = 1').import :force=>true +#Project.where('is_public = 1').import :force=>true diff --git a/app/models/user.rb b/app/models/user.rb index 15578f6db..bf2bca6db 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -249,7 +249,7 @@ class User < Principal where("#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id) } scope :sorted, lambda { order(*User.fields_for_order_statement)} - + scope :indexable,lambda { where('id not in (2,4)')} #用于elastic建索引的scope,id为2是匿名用户,4是管理员,不能被索引 scope :like, lambda {|arg, type| if arg.blank? where(nil) @@ -1216,4 +1216,4 @@ end # Index all article records from the DB to Elasticsearch # 匿名用户 角色 和 管理员角色不能被索引 -User.where('id not in (2,4)').import :force=>true +#User.where('id not in (2,4)').import :force=>true diff --git a/lib/tasks/elasticsearch.rake b/lib/tasks/elasticsearch.rake new file mode 100644 index 000000000..1242abc60 --- /dev/null +++ b/lib/tasks/elasticsearch.rake @@ -0,0 +1 @@ +require 'elasticsearch/rails/tasks/import' \ No newline at end of file From b05708f6e8dff7c954fe2d21f5a0deba8d2c6e2c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 10:43:21 +0800 Subject: [PATCH 053/913] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E4=B8=89=E4=B8=AAbug:=201.=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=97=B6=EF=BC=8C=E7=BD=AE=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=92=8C=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8F=96=E6=B6=88=E6=8C=89=E9=92=AE=EF=BC=8C=E5=8D=B4?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E2=80=9C=E6=A0=87=E9=A2=98=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E2=80=9D=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=202.=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=BB=84=E7=BB=87=EF=BC=9A=E7=82=B9=E5=87=BB=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8C=89=E9=92=AE=E4=B8=8D=E5=BA=94=E8=AF=A5=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E8=B5=B7=E5=85=B3=E8=81=94=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=203.=E7=BB=84=E7=BB=87=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=86=85=E5=86=8D=E7=BC=96=E8=BE=91=E7=BB=84?= =?UTF-8?q?=E7=BB=87=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE=E5=AE=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E6=8C=89=E9=92=AE=E5=90=8E=E5=8F=88=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=BB=84=E7=BB=87=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=BA=94=E8=BF=94=E5=9B=9E=E7=BB=84=E7=BB=87=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_document_comments_controller.rb | 9 ++++++++- app/views/courses/settings/_join_org.html.erb | 3 +-- app/views/org_document_comments/_new.html.erb | 5 +++-- app/views/org_document_comments/edit.html.erb | 2 +- app/views/org_document_comments/show.html.erb | 2 +- app/views/organizations/_join_course_menu.html.erb | 3 ++- app/views/organizations/_join_project_menu.html.erb | 3 ++- app/views/organizations/_show_org_document.html.erb | 2 +- app/views/projects/settings/_join_org.html.erb | 4 +--- 9 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 61a27c433..776bd132d 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -38,12 +38,19 @@ class OrgDocumentCommentsController < ApplicationController act.update_attributes(:updated_at => @org_document.updated_at) end respond_to do |format| - format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)} + format.html { + if params[:flag] == 0 + redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id) + else + redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id) + end + } end end def edit @org_document = OrgDocumentComment.find(params[:id]) + @flag = params[:flag] @organization = Organization.find(params[:organization_id]) end diff --git a/app/views/courses/settings/_join_org.html.erb b/app/views/courses/settings/_join_org.html.erb index cd2d515cc..fff0f807c 100644 --- a/app/views/courses/settings/_join_org.html.erb +++ b/app/views/courses/settings/_join_org.html.erb @@ -68,8 +68,7 @@ }); }); function cancel_join_orgs() { - $("#search_orgs_result_list").html(""); - $("#paginator").css("display", "none") + $("#join_orgs_for_course input:checked").attr("checked", false); } function course_join_org(courseId) { $.ajax({ diff --git a/app/views/org_document_comments/_new.html.erb b/app/views/org_document_comments/_new.html.erb index 3a3356c66..a7ce22548 100644 --- a/app/views/org_document_comments/_new.html.erb +++ b/app/views/org_document_comments/_new.html.erb @@ -25,13 +25,14 @@ $("#document_title").val(""); org_document_description_editor.html(""); org_document_description_editor.sync(); - $('#org_document_editor').hide(); $('#doc_title_hint').hide(); + $('#org_document_editor').hide(); + $('#doc_title_hint').hide(); } <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
        - +
        diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 4b50c1064..c4a74c791 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -17,7 +17,7 @@
        -<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id),:method => 'put', :id => 'new_org_document_form' do |f| %> +<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag),:method => 'put', :id => 'new_org_document_form' do |f| %>
        diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 9df568e02..31e4f7e05 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -43,7 +43,7 @@ <% end %>
      • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :class => "postOptionLink" %> + <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
      • <%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete', diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index e11ef46e0..e66d0bcce 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -79,7 +79,8 @@ }); }); function cancel_join_courses() { - $("#search_courses_result_list").html(""); + $("#join_courses_form input:checked").attr("checked", false); + //$("#search_courses_result_list").html(""); } function org_join_courses(orgId) { $.ajax({ diff --git a/app/views/organizations/_join_project_menu.html.erb b/app/views/organizations/_join_project_menu.html.erb index 4b77ee043..765b4b23a 100644 --- a/app/views/organizations/_join_project_menu.html.erb +++ b/app/views/organizations/_join_project_menu.html.erb @@ -75,7 +75,8 @@ }); }); function cancel_join_projects() { - $("#search_projects_result_list").html(""); + $("#join_projects_form input:checked").attr("checked", false); + //$("#search_projects_result_list").html(""); } function org_join_projects(orgId) { $.ajax({ diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 0142e6f37..888cbbf68 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -36,7 +36,7 @@ <% end %>
      • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %> + <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 0), :class => "postOptionLink" %>
      • <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', diff --git a/app/views/projects/settings/_join_org.html.erb b/app/views/projects/settings/_join_org.html.erb index 8b8425934..982e7b79e 100644 --- a/app/views/projects/settings/_join_org.html.erb +++ b/app/views/projects/settings/_join_org.html.erb @@ -67,9 +67,7 @@ }); }); function cancel_join_orgs() { - $("#search_orgs_result_list").html(""); - $("#paginator").html(""); - $("#paginator").css("display", "none"); + $("#join_orgs_for_project input:checked").attr("checked", false); } function join_org(projectId) { $.ajax({ From 042b1977671e99cd8180ba2120bbc4f37f8c4a4f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 10:49:41 +0800 Subject: [PATCH 054/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=E7=95=8C=E9=9D=A2=E8=B0=83=E6=95=B4=20=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E8=A7=A6=E5=8F=91=E7=9A=84=E6=97=B6=E5=80=99=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=80=BB=E5=88=86=20=E6=9B=B4=E6=8D=A2=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 20 ++++--- app/helpers/courses_helper.rb | 2 +- app/models/course_contributor_score.rb | 2 +- app/views/courses/_tool_expand.html.erb | 14 ++--- app/views/layouts/base_courses.html.erb | 58 +++++++++++-------- ...1125072235_add_course_contributor_score.rb | 36 ------------ ...1351_add_course_contributor_total_score.rb | 36 ++++++++++++ db/schema.rb | 2 +- public/stylesheets/courses.css | 2 +- 9 files changed, 94 insertions(+), 78 deletions(-) delete mode 100644 db/migrate/20151125072235_add_course_contributor_score.rb create mode 100644 db/migrate/20151127011351_add_course_contributor_total_score.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a65ed639c..046e0c5a0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -83,34 +83,38 @@ module ApplicationHelper when "JournalForMessage" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0) + :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1) else score = course_contributor_score.journal_num + 1 - course_contributor_score.update_attributes(:journal_num => score) + total_score = course_contributor_score.total_score + 1 + course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score) end when "Message" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2) else score = course_contributor_score.message_num + 2 - course_contributor_score.update_attributes(:message_num => score) + total_score = course_contributor_score.total_score + 2 + course_contributor_score.update_attributes(:message_num => score, :total_score => total_score) end when "MessageReply" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1, - :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) else score = course_contributor_score.message_reply_num + 1 - course_contributor_score.update_attributes(:message_reply_num => score) + total_score = course_contributor_score.total_score + 1 + course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score) end when "NewReply" if course_contributor_score.nil? CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) + :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) else score = course_contributor_score.news_reply_num + 1 - course_contributor_score.update_attributes(:news_reply_num => score) + total_score = course_contributor_score.total_score + 1 + course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score) end end end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 022d86d9b..1d82d035d 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -758,7 +758,7 @@ module CoursesHelper end def contributor_course_scor(course_id) - ccs = CourseContributorScore.where("course_id =?", course_id).limit(9) + ccs = CourseContributorScore.where("course_id =?", course_id).order("total_score desc") .limit(9) end end diff --git a/app/models/course_contributor_score.rb b/app/models/course_contributor_score.rb index 598b8e014..f2b05458f 100644 --- a/app/models/course_contributor_score.rb +++ b/app/models/course_contributor_score.rb @@ -1,5 +1,5 @@ class CourseContributorScore < ActiveRecord::Base - attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id + attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score belongs_to :course belongs_to :user end diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index cec5311c6..9a36b8efb 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -2,19 +2,19 @@ <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% if show_nav?(@course.homework_commons.count) %> <% end %> <% if show_nav?(@course.news.count) %> <% end %> <% if show_nav?(course_file_num) %> <%# 课程贡献榜 %>
        + <% unless contributor_course_scor(@course.id).count == 0 %> + <% end %> +

        <%= l(:label_course_brief_introduction)%>:

        diff --git a/db/migrate/20151125072235_add_course_contributor_score.rb b/db/migrate/20151125072235_add_course_contributor_score.rb deleted file mode 100644 index 99ef60cf0..000000000 --- a/db/migrate/20151125072235_add_course_contributor_score.rb +++ /dev/null @@ -1,36 +0,0 @@ -class AddCourseContributorScore < ActiveRecord::Migration - def up - # course_count = Course.all.count / 30 + 1 - # transaction do - # for i in 1 ... course_count do i - Course.all.each do |course| - if course.course_activities.count > 1 - course.student.each do |s| - puts course.id - puts course.name - puts s.student_id - # board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2 - board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is null;").count * 2 - message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1 - common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1 - # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5 - attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5 - journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1 - # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1 - # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1 - total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count - if total !=0 - CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count, - :news_reply_num => common_reply_count, :resource_num => attachment_count, :journal_num => journal_count, :journal_reply_num => 0, :total => total) - end - - end - end - end - # end - # end - end - - def down - end -end \ No newline at end of file diff --git a/db/migrate/20151127011351_add_course_contributor_total_score.rb b/db/migrate/20151127011351_add_course_contributor_total_score.rb new file mode 100644 index 000000000..2606864d8 --- /dev/null +++ b/db/migrate/20151127011351_add_course_contributor_total_score.rb @@ -0,0 +1,36 @@ +class AddCourseContributorTotalScore < ActiveRecord::Migration + def up + # course_count = Course.all.count / 30 + 1 + # transaction do + # for i in 1 ... course_count do i + Course.all.each do |course| + if course.course_activities.count > 1 + course.student.each do |s| + puts course.id + puts course.name + puts s.student_id + # board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2 + board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is null;").count * 2 + message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1 + common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1 + # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5 + attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5 + journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1 + # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1 + # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1 + total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count + if total !=0 + CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count, + :news_reply_num => common_reply_count, :resource_num => attachment_count, :journal_num => journal_count, :journal_reply_num => 0, :total_score => total) + end + + end + end + end + # end + # end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8a0ec8605..8e2082b37 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 => 20151126160252) do +ActiveRecord::Schema.define(:version => 20151127011351) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 7d5d66103..bdcfbd08e 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1172,7 +1172,7 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .courseMenuSetting {background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top:3px; float:right; margin-right:5px;} .courseMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;} .rankList {width:220px; padding:10px; background-color:#ffffff; margin-top:10px;} -.rankList li {width:73px; padding:5px 0px; text-align:center; float:left; position:relative;} +.rankList li {width:73px; padding:8px 0px 0px 0px; text-align:center; float:left; position:relative;} .rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;} .rankPortrait {border-radius:50%; width:35px; height:35px;} .numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; width:65px; color:#585858;} \ No newline at end of file From 2d14b66336007ab94e483b81e71dfbb4122f5d16 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 Nov 2015 10:56:46 +0800 Subject: [PATCH 055/913] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_student_work_list.html.erb | 102 +++++++++--------- public/stylesheets/courses.css | 2 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index c18ec4c73..e9b056c84 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -1,52 +1,52 @@ -
        - - 作品 - - (<%= @student_work_count%>人已交) - - <% if !@is_teacher && @stundet_works.empty?%> - 您尚未提交作品 - <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> - 您已提交且不可再修改,因为截止日期已过 - <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> - 您已提交,您还可以修改 - <% end %> - - <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%> -
        - - -
        - <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> - <% end%> - -
        -
        - -
        - <% if @is_evaluation && !@stundet_works.empty?%> - <%= render :partial => "evaluation_title"%> - <% else%> - <%= render :partial => "evaluation_un_title"%> - <% end%> -
        -
        - -<% @stundet_works.each do |student_work|%> - <% if @is_evaluation%> - <%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%> - <% else%> - <%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%> - <% end%> -
        -
        - <% if student_work.user == User.current && !@is_evaluation %> - <% if @homework.homework_type == 2%> - <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> - <% else %> - <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> - <% end %> - <% end %> -
        -
        +
        + + 作品 + + (<%= @student_work_count%>人已交) + + <% if !@is_teacher && @stundet_works.empty?%> + 您尚未提交作品 + <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> + 您已提交且不可再修改,因为截止日期已过 + <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> + 您已提交,您还可以修改 + <% end %> + + <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%> +
        + + +
        + <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> + <% end%> + +
        +
        + +
        + <% if @is_evaluation && !@stundet_works.empty?%> + <%= render :partial => "evaluation_title"%> + <% else%> + <%= render :partial => "evaluation_un_title"%> + <% end%> +
        +
        + +<% @stundet_works.each do |student_work|%> + <% if @is_evaluation%> + <%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%> + <% else%> + <%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%> + <% end%> +
        +
        + <% if student_work.user == User.current && !@is_evaluation %> + <% if @homework.homework_type == 2%> + <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% else %> + <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% end %> + <% end %> +
        +
        <% end%> \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 17ed37e05..faffee4d1 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -60,7 +60,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .hworkStName {width:60px; max-width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .hworkStID {width:80px; max-width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .hworkDate {max-width:150px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:14px; line-height:14px; font-size:12px; color:#888888;} -.hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2;} +.hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2; z-index:99;} a.hworkExport {background:url(../images/homepage_icon2.png) -10px -401px no-repeat; padding-left:23px;} a.hworkSetting {background:url(../images/homepage_icon2.png) -10px -450px no-repeat; padding-left:23px;} .hworkInfor {font-size:12px; color:#269ac9; width:80px; height:40px; vertical-align:middle; float:left; line-height:40px; text-align:center; font-weight:bold;} From f448b5f8e2ea2129f3d2e1c02e6717b2b893b947 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 11:00:06 +0800 Subject: [PATCH 056/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 5f9c9d67e..fccf40742 100644 --- a/config/application.rb +++ b/config/application.rb @@ -76,9 +76,9 @@ module RedmineApp if RbConfig::CONFIG['target_os'] == 'mswin32' Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`) - Elasticsearch::Client.new hosts: ['192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`) - Elasticsearch::Client.new hosts: ['192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true end end From 4aa827eb4a24737eeef3de96920d35efd44cabf0 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 11:02:48 +0800 Subject: [PATCH 057/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E7=82=B9=E5=87=BB=E9=A1=B9=E7=9B=AE=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=B1=95=E5=BC=80=E5=88=97=E8=A1=A8=EF=BC=9B?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=AF=BE=E7=A8=8B=E5=90=8C=E6=A0=B7=E5=A6=82?= =?UTF-8?q?=E6=AD=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org.html.erb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index e5c238ac5..89777de01 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -85,7 +85,7 @@
        <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
        -
        项目 +
        项目
        • @@ -100,7 +100,7 @@
        -
        +
          <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> @@ -109,7 +109,7 @@
        -
        课程 +
        课程
        • @@ -124,7 +124,7 @@
        -
        +
          <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
        @@ -146,8 +146,6 @@
        - - From 768aff89da69c187e3db503d138a7a9238b7e29b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 11:09:01 +0800 Subject: [PATCH 058/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index fccf40742..fcf2d97d4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -75,10 +75,14 @@ module RedmineApp config.after_initialize do if RbConfig::CONFIG['target_os'] == 'mswin32' Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true - elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`) + elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n","")) + Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true + elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true - elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`) + elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true + else + Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true end end From 1115d54d9a55cd7065686f687a686cb1304054ab Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Fri, 27 Nov 2015 11:25:16 +0800 Subject: [PATCH 059/913] =?UTF-8?q?=E9=9D=9Etrustie=E7=94=A8=E6=88=B7chang?= =?UTF-8?q?esets=5Flatest=5Fcoimmit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 2 +- app/views/repositories/show.html.erb | 17 ++++++++++++----- public/stylesheets/repository.css | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index ddabb5356..ff4aa61fb 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -61,7 +61,7 @@ module RepositoriesHelper def user_commit_rep(mail) user = User.find_by_mail(mail) - user.nil? ? User.find(2) : User.find_by_mail(mail) + #user.nil? ? User.find(2) : User.find_by_mail(mail) end def render_properties(properties) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 7aac3af1d..0a95851d0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -29,11 +29,18 @@
        <% if @changesets && !@changesets.empty? %> - <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> -
        <%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
        -
        提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
        -
        <%= @changesets_latest_coimmit.message %>
        -
        + <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> + <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> +
        <%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
        +
        提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
        +
        <%= @changesets_latest_coimmit.message %>
        +
        + <% else %> +
        <%=@changesets_latest_coimmit.author_email %>
        +
        提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
        +
        <%= @changesets_latest_coimmit.message %>
        +
        + <%end%> <% end %> <%= @repository.branches.count %> 个分支 diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index 27941cb9e..2e084d61c 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -220,7 +220,7 @@ .vl_branch {background:url(../images/vlicon/branch_icon.png) 0px -2px no-repeat; padding-left:22px} .mt1 {margin-top:1px;} .mt2 {margin-top:2px;} -.commit_content_dec{width: 300px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis;} +.commit_content_dec{width: 200px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis;} /*提交信息列表*/ .col-md-10 { From 6be917e052fbe162964bce7372ed1698b0c4206d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 11:34:42 +0800 Subject: [PATCH 060/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index fcf2d97d4..69b88a76d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -73,10 +73,10 @@ module RedmineApp end config.after_initialize do - if RbConfig::CONFIG['target_os'] == 'mswin32' + if RbConfig::CONFIG['target_os'] == 'mingw32' Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n","")) - Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n","")) From e0f4050779cab8a2ba58b7589e18220634b0a00f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 12:34:02 +0800 Subject: [PATCH 061/913] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=B8=AD=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E5=92=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E5=86=85=E5=AE=B9=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/views/layouts/base_org.html.erb | 57 ++++++++++--------- app/views/organizations/join_projects.js.erb | 3 + ...124032319_delete_useless_org_activities.rb | 2 +- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index dce472346..ba4dda939 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -225,7 +225,7 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select projects.* from projects inner join members on projects.id = members.course_id where members.user_id = #{User.current.id} and projects.name like '#{condition}'" + sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" user_projects = Course.find_by_sql(sql) @added_course_ids = @organization.projects.map(&:id) @projects = [] diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 89777de01..b89977b09 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -85,19 +85,21 @@
        <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
        -
        项目 -
        -
          -
        • -
            - -
          • - <%= link_to "加入项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> -
          • -
          -
        • -
        -
        +
        + 项目 + <%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + + + + + + + + + + + +
        @@ -109,19 +111,22 @@
    -
    课程 -
    -
      -
    • -
        - -
      • - <%= link_to "加入课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> -
      • -
      -
    • -
    -
    +
    + 课程 + <%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> + + + + + + + + + + + +
    diff --git a/app/views/organizations/join_projects.js.erb b/app/views/organizations/join_projects.js.erb index e69de29bb..b796d5f99 100644 --- a/app/views/organizations/join_projects.js.erb +++ b/app/views/organizations/join_projects.js.erb @@ -0,0 +1,3 @@ +//$("#homepageLeftMenuProjects").html(""); +//$("#homepageLeftMenuProjects").append("
      "); +//$("#homepageLeftMenuProjects").append("<%#= escape_javascript %>") \ No newline at end of file diff --git a/db/migrate/20151124032319_delete_useless_org_activities.rb b/db/migrate/20151124032319_delete_useless_org_activities.rb index 705e0dbed..57d858e7e 100644 --- a/db/migrate/20151124032319_delete_useless_org_activities.rb +++ b/db/migrate/20151124032319_delete_useless_org_activities.rb @@ -3,7 +3,7 @@ class DeleteUselessOrgActivities < ActiveRecord::Migration OrgActivity.all.each do |act| if act.container_type == 'Course' if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 - puts "course" + act.destroy end else if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0 From bf1c1cf0a1082988d72e5597ed226a387ec7d579 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 13:07:09 +0800 Subject: [PATCH 062/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index a67fcfaea..ee1342df5 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,8 @@ gem 'chinese_pinyin' # gem 'sunspot_solr' # gem 'sunspot' # gem 'progress_bar' +gem 'ansi' +gem 'win32console' gem 'kaminari' gem 'elasticsearch-model' gem 'elasticsearch-rails' From 0992ddd0f6d1d7b98fe089ba88a42edb8c2d243f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 13:07:25 +0800 Subject: [PATCH 063/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 69b88a76d..61f73ee3d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -74,7 +74,7 @@ module RedmineApp config.after_initialize do if RbConfig::CONFIG['target_os'] == 'mingw32' - Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) From c28b8bab1486ea0025f0127cd79e301b89b23741 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 13:09:20 +0800 Subject: [PATCH 064/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ee1342df5..0125e9d60 100644 --- a/Gemfile +++ b/Gemfile @@ -35,7 +35,7 @@ gem 'chinese_pinyin' # gem 'sunspot' # gem 'progress_bar' gem 'ansi' -gem 'win32console' + gem 'kaminari' gem 'elasticsearch-model' gem 'elasticsearch-rails' @@ -44,6 +44,7 @@ group :development do gem 'grape-swagger' gem 'better_errors', '~> 1.1.0' gem 'rack-mini-profiler', '~> 0.9.3' + gem 'win32console' end group :development, :test do From 365349878dad13ca703a9d66459155bd23312d86 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 13:17:23 +0800 Subject: [PATCH 065/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=88=96=E8=80=85=E8=AF=BE=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E5=92=8C?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=EF=BC=9B=E5=90=8C=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=BC=B9=E7=AA=97=E7=BB=99=E5=87=BA=E5=85=B3=E8=81=94?= =?UTF-8?q?=E6=88=90=E5=8A=9F=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/organizations/_join_course_menu.html.erb | 1 + app/views/organizations/_join_project_menu.html.erb | 1 + app/views/organizations/join_courses.js.erb | 5 +++++ app/views/organizations/join_projects.js.erb | 8 +++++--- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index e66d0bcce..a643acdcf 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -91,6 +91,7 @@ url: "/organizations/" + orgId + "/search_courses?name=" + $("input[name='courses']").val().trim(), type: "get" }); + alert("加入成功"); } }); } diff --git a/app/views/organizations/_join_project_menu.html.erb b/app/views/organizations/_join_project_menu.html.erb index 765b4b23a..ea5b4ce25 100644 --- a/app/views/organizations/_join_project_menu.html.erb +++ b/app/views/organizations/_join_project_menu.html.erb @@ -87,6 +87,7 @@ url: "/organizations/" + orgId + "/search_projects?name=" + $("input[name='projects']").val().trim(), type: "get" }); + alert("加入成功"); } }); } diff --git a/app/views/organizations/join_courses.js.erb b/app/views/organizations/join_courses.js.erb index e69de29bb..1c234704e 100644 --- a/app/views/organizations/join_courses.js.erb +++ b/app/views/organizations/join_courses.js.erb @@ -0,0 +1,5 @@ +$("#homepageLeftMenuCourses").html(""); +$("#homepageLeftMenuCourses").append("
        "); +$("#homepageLeftMenuCourses").append("<%= escape_javascript(render :partial => 'layouts/org_courses', + :locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>"); +$("#homepageLeftMenuCourses").append("
      "); \ No newline at end of file diff --git a/app/views/organizations/join_projects.js.erb b/app/views/organizations/join_projects.js.erb index b796d5f99..1db8021bf 100644 --- a/app/views/organizations/join_projects.js.erb +++ b/app/views/organizations/join_projects.js.erb @@ -1,3 +1,5 @@ -//$("#homepageLeftMenuProjects").html(""); -//$("#homepageLeftMenuProjects").append("
        "); -//$("#homepageLeftMenuProjects").append("<%#= escape_javascript %>") \ No newline at end of file +$("#homepageLeftMenuProjects").html(""); +$("#homepageLeftMenuProjects").append("
          "); +$("#homepageLeftMenuProjects").append("<%= escape_javascript(render :partial => 'layouts/org_projects', + :locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>"); +$("#homepageLeftMenuProjects").append("
        "); \ No newline at end of file From 1cc6e305ed723e3686ac9a3612eae560d488ea9f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 13:52:40 +0800 Subject: [PATCH 066/913] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=96=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A8=A1=E5=9D=97=E5=BC=80=E5=8F=91=EF=BC=9A=201?= =?UTF-8?q?=E3=80=81=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E6=88=90=E7=BB=A9?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E6=98=BE=E7=A4=BA=202=E3=80=81=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A1=86=E5=B1=95=E5=BC=80=E6=B2=A1=E6=9C=89=E5=88=99?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 17 ++++++++ app/helpers/courses_helper.rb | 3 -- app/models/attachment.rb | 17 +------- app/views/layouts/base_courses.html.erb | 55 ++++++++++++++----------- public/stylesheets/courses.css | 2 +- 5 files changed, 49 insertions(+), 45 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index a2902e3fc..b15be4896 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -374,6 +374,9 @@ class FilesController < ApplicationController if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') Mailer.run.attachments_added(attachments[:files]) end + # 更新课程英雄榜得分 + update_contributor_score(@course, attachments[:files].first) + # end if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) params[:course_attachment_type].each do |type| tag_name = get_tag_name_by_type_number type @@ -423,6 +426,20 @@ class FilesController < ApplicationController end end + def update_contributor_score(course, file ) + unless file.author.allowed_to?(:as_teacher, course) + course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first + if course_contributor_score.nil? + CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0, + :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5) + else + score = course_contributor_score.resource_num + 5 + total_score = course_contributor_score.total_score + 5 + course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score) + end + end + end + def get_tag_name_by_type_number type case type when "1" diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 1d82d035d..a1b119cb5 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -751,10 +751,7 @@ module CoursesHelper JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9" - sql = ActiveRecord::Base.connection() homework_scores = Member.find_by_sql(sql_select) - sql.close() - homework_scores end def contributor_course_scor(course_id) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 45d19e681..9c6bb9cb1 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,11 +73,10 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location,:act_as_course_activity, :act_as_student_score + before_save :files_to_final_location,:act_as_course_activity after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score - # after_save :act_as_student_score # add by nwb # 获取所有可公开的资源文件列表 @@ -562,18 +561,4 @@ class Attachment < ActiveRecord::Base end end - # 课程成员得分(英雄榜) - def act_as_student_score - unless self.author.allowed_to?(:as_teacher, self.container) - course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", self.container_id, self.author_id).first - if course_contributor_score.nil? - CourseContributorScore.create(:course_id => self.container_id, :user_id => self.author_id, :message_num => 0, :message_reply_num => 0, - :news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0) - else - score = course_contributor_score.news_reply_num + 5 - course_contributor_score.update_attributes(:resource_num => score) - end - end - end - end diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 00c56b7ee..603f7febb 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -196,59 +196,64 @@
    <% end %> <%# 工具栏展开 %> - - + <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || + course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %> + + + <% end %>
    <%# 课程贡献榜 %>
    <% unless contributor_course_scor(@course.id).count == 0 %> -
      +

        课程贡献榜

        <% contributor_course_scor(@course.id).each do |contributor_score| %> + <% unless contributor_score.total_score ==0 %>
      • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>

        <%=link_to contributor_score.user, user_path(contributor_score.user), :title => contributor_score.user %>

        - <%#= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id }, - :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", - :onmouseover =>"message_titile_show($(this),event)", - :onmouseout => "message_titile_hide($(this))" %> <%= contributor_score.total_score.to_i %>

      • + <% end %> <% end %>
      + <% end %> + + <% hero_homework_scores = hero_homework_score(@course, "desc") %> + <% unless hero_homework_scores.map(&:score).detect{|s| s != nil}.nil? %> + <% end %> -
      diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index bdcfbd08e..f840f20cf 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1175,4 +1175,4 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .rankList li {width:73px; padding:8px 0px 0px 0px; text-align:center; float:left; position:relative;} .rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;} .rankPortrait {border-radius:50%; width:35px; height:35px;} -.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; width:65px; color:#585858;} \ No newline at end of file +.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;} \ No newline at end of file From 3d9f6321055bec0466e02e7676f5c7c9b3d471ca Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 14:42:25 +0800 Subject: [PATCH 067/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/elasticsearch_batch_op.rake | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/tasks/elasticsearch_batch_op.rake diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake new file mode 100644 index 000000000..fb2c638bc --- /dev/null +++ b/lib/tasks/elasticsearch_batch_op.rake @@ -0,0 +1,31 @@ +namespace :importer do + task :importuser do + ENV['CLASS']='User' + ENV['SCOPE']='indexable' + ENV['FORCE']='y' + ENV['BATCH']='1000' + Rake::Task["elasticsearch:import:model"].invoke + end + task :importproject do + + ENV['CLASS']='Project' + ENV['SCOPE']='indexable' + ENV['FORCE']='y' + ENV['BATCH']='1000' + Rake::Task["elasticsearch:import:model"].invoke + end + task :importcourse do + ENV['CLASS']='Course' + ENV['SCOPE']='indexable' + ENV['FORCE']='y' + ENV['BATCH']='1000' + Rake::Task["elasticsearch:import:model"].invoke + end + task :importattachment do + ENV['CLASS']='Attachment' + ENV['SCOPE']='indexable' + ENV['FORCE']='y' + ENV['BATCH']='1000' + Rake::Task["elasticsearch:import:model"].invoke + end +end \ No newline at end of file From 25b66b5dbbd5a7b7b661c4409fbc30481d35dc68 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 14:43:08 +0800 Subject: [PATCH 068/913] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_join_course_menu.html.erb | 1 - app/views/organizations/_join_project_menu.html.erb | 1 - 2 files changed, 2 deletions(-) diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index a643acdcf..e66d0bcce 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -91,7 +91,6 @@ url: "/organizations/" + orgId + "/search_courses?name=" + $("input[name='courses']").val().trim(), type: "get" }); - alert("加入成功"); } }); } diff --git a/app/views/organizations/_join_project_menu.html.erb b/app/views/organizations/_join_project_menu.html.erb index ea5b4ce25..765b4b23a 100644 --- a/app/views/organizations/_join_project_menu.html.erb +++ b/app/views/organizations/_join_project_menu.html.erb @@ -87,7 +87,6 @@ url: "/organizations/" + orgId + "/search_projects?name=" + $("input[name='projects']").val().trim(), type: "get" }); - alert("加入成功"); } }); } From e710f443c2dfc61d8711b872363cca32dab80417 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 15:17:17 +0800 Subject: [PATCH 069/913] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 5 +++-- app/models/course.rb | 12 ++++++++++-- app/models/project.rb | 4 ++-- app/models/user.rb | 1 - 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index dea4e404e..ebabbf944 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -119,8 +119,9 @@ class Attachment < ActiveRecord::Base } }, sort:{ - downloads: {order:"desc"}, - _score:{order:"desc"} + _score:{order:"desc"}, + downloads: {order:"desc"} + }, highlight: { pre_tags: [''], diff --git a/app/models/course.rb b/app/models/course.rb index 8f7c990ab..0bd14d38b 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -122,8 +122,9 @@ class Course < ActiveRecord::Base } }, sort: { - updated_at:{order:"desc"}, - _score:{order: "desc" } + _score:{order: "desc" }, + updated_at:{order:"desc"} + }, highlight: { pre_tags: [''], @@ -393,13 +394,20 @@ class Course < ActiveRecord::Base # __elasticsearch__.delete_document # end def create_course_ealasticsearch_index + if self.is_public == 1 self.__elasticsearch__.index_document + end end def update_course_ealasticsearch_index + if self.is_public == 1 self.__elasticsearch__.update_document + end end def delete_course_ealasticsearch_index + + if self.is_public == 1 self.__elasticsearch__.delete_document + end end end diff --git a/app/models/project.rb b/app/models/project.rb index 034873596..847c536da 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -194,8 +194,8 @@ class Project < ActiveRecord::Base multi_match: { query: query, type:"most_fields", - operator: "and", - fields: ['name'] + operator: "or", + fields: ['name','description^0.5'] } }, sort: { diff --git a/app/models/user.rb b/app/models/user.rb index bf2bca6db..ced747af8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,7 +36,6 @@ class User < Principal indexes :firstname, analyzer: 'smartcn',index_options: 'offsets' indexes :lastname, analyzer: 'smartcn',index_options: 'offsets' indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets',type: 'date' - indexes :id, analyzer: 'smartcn',index_options: 'offsets' end end From f7ac2b0ef5e67b8bb8aa48b7bc8953455c5a6eb5 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 27 Nov 2015 15:19:13 +0800 Subject: [PATCH 070/913] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=9A=84=E7=AD=94=E5=8D=B7=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 29 +++++++++++++++---- app/views/exercise/_edit_head.html.erb | 5 ++-- app/views/exercise/_exercise_form.html.erb | 2 +- .../_exercise_student_result.html.erb | 20 ++++++------- app/views/exercise/_show_head.html.erb | 3 +- app/views/exercise/_student_exercise.html.erb | 8 ++++- app/views/exercise/show.html.erb | 2 +- .../exercise/show_student_result.html.erb | 1 + config/routes.rb | 1 + public/stylesheets/courses.css | 4 +-- 10 files changed, 50 insertions(+), 25 deletions(-) create mode 100644 app/views/exercise/show_student_result.html.erb diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 0a95fd025..6d6d429b6 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,7 +1,7 @@ class ExerciseController < ApplicationController layout "base_courses" - before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise] + before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,:show_student_result] before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list] include ExerciseHelper @@ -34,7 +34,7 @@ class ExerciseController < ApplicationController render_403 return end - exercise_end = Time.parse(format_time(@exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") + exercise_end = @exercise.end_time > Time.now if @exercise.time == -1 @can_edit_excercise = exercise_end else @@ -59,6 +59,9 @@ class ExerciseController < ApplicationController # @percent = get_percent(@exercise,User.current) exercise_questions = @exercise.exercise_questions @exercise_questions = paginateHelper exercise_questions,5 #分页 + score = calculate_student_score(@exercise, User.current) + eu = get_exercise_user(@exercise.id, User.current.id) + eu.update_attributes(:score => score) respond_to do |format| format.html {render :layout => 'base_courses'} end @@ -342,10 +345,10 @@ class ExerciseController < ApplicationController @exercise = Exercise.find params[:id] @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") @exercise_count = @exercise.exercise_users.where('score is not NULL').count - if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S")) + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now) @exercise_users_list = @exercise.exercise_users.where('score is not NULL') @show_all = true; - elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S") + elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now @exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id) else @exercise_users_list = [] @@ -359,7 +362,7 @@ class ExerciseController < ApplicationController def commit_answer eq = ExerciseQuestion.find(params[:exercise_question_id]) # 已提交过的且是限时的则不允许答题 - if (has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1) || Time.parse(format_time(@exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") < Time.now.strftime("%Y-%m-%d %H:%M:%S") + if (has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1) || @exercise.end_time < Time.now render :json => {:text => "failure"} return end @@ -483,7 +486,7 @@ class ExerciseController < ApplicationController @exercise.update_attributes(:publish_time => Time.now) redirect_to exercise_url(@exercise) return - elsif Time.parse(@exercise.publish_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S") + elsif @exercise.publish_time > Time.now @exercise.update_attributes(:show_result => params[:show_result]) redirect_to exercise_url(@exercise) return @@ -521,6 +524,20 @@ class ExerciseController < ApplicationController end end + #查看学生的答卷情况 + def show_student_result + @user = User.find params[:user_id] + @can_edit_excercise = false + @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first + @exercise_questions = @exercise.exercise_questions + score = calculate_student_score(@exercise, @user) + eu = get_exercise_user(@exercise.id, @user.id) + eu.update_attributes(:score => score) + respond_to do |format| + format.html {render :layout => 'base_courses'} + end + end + # 计算学生得分 def calculate_student_score(exercise, user) score = 0 diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index c8ba0c4d7..b69f52a56 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -30,10 +30,11 @@ \ No newline at end of file diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index e283f8b0c..f0bef74bf 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -9,7 +9,7 @@ var popWindow ; //弹出框的引用 var importPollPopWindow; //选择导入的弹出框引用 function edit_head(){ - $("#polls_description").val($("#polls_description_div").html()); + $("#exercise_description").val($("#exercise_description_div").html()); } $(function(){ //点击空白处 diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 93e52b0a1..529a73da3 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -32,8 +32,8 @@
      第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) - <% answer = get_user_answer(exercise_question, User.current)%> - <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> + <% answer = get_user_answer(exercise_question, user)%> + <% standard_answer = get_user_standard_answer(exercise_question, user)%> <% if !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %> √ <% else %> @@ -49,7 +49,7 @@ @@ -71,9 +71,9 @@
      第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) - <% answer = get_user_answer(exercise_question, User.current)%> - <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if !standard_answer.empty? && get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %> + <% answer = get_user_answer(exercise_question, user)%> + <% standard_answer = get_user_standard_answer(exercise_question, user)%> + <% if !standard_answer.empty? && get_mulscore(exercise_question, user).to_i == standard_answer.first.exercise_choice_id %> √ <% else %> × @@ -88,7 +88,7 @@ @@ -110,8 +110,8 @@
      第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) - <% answer = get_user_answer(exercise_question, User.current)%> - <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> + <% answer = get_user_answer(exercise_question, user)%> + <% standard_answer = get_user_standard_answer(exercise_question, user)%> <% if !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) %> √ <% else %> @@ -126,7 +126,7 @@ <% end %>
      - > + >
      diff --git a/app/views/exercise/_show_head.html.erb b/app/views/exercise/_show_head.html.erb index f385e58b8..cfa814c2e 100644 --- a/app/views/exercise/_show_head.html.erb +++ b/app/views/exercise/_show_head.html.erb @@ -11,7 +11,6 @@ 测验时长:<%= exercise.time %>分钟 <% end %>
      -
      <%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%>
      -
      +
      <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
      \ No newline at end of file diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 25bf3f7cd..4e27d57cb 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -44,7 +44,13 @@
      • - <%= exercise.user.show_name%> + <% name = exercise.user.show_name %> + <% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> + <%= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> + <% else %> + <%=name%> + <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> + <% end %>
      • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> diff --git a/app/views/exercise/show.html.erb b/app/views/exercise/show.html.erb index f47710d1c..c488ec203 100644 --- a/app/views/exercise/show.html.erb +++ b/app/views/exercise/show.html.erb @@ -5,6 +5,6 @@ <% if @can_edit_excercise %> <%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %> <% else %> - <%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %> + <%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user=>User.current} %> <% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/show_student_result.html.erb b/app/views/exercise/show_student_result.html.erb new file mode 100644 index 000000000..6b32a0dd0 --- /dev/null +++ b/app/views/exercise/show_student_result.html.erb @@ -0,0 +1 @@ +<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user =>@user} %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index d137553ad..cbff8558f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -168,6 +168,7 @@ RedmineApp::Application.routes.draw do get 'export_exercise' get 'publish_exercise' get 'republish_exercise' + get 'show_student_result' post 'create_exercise_question' post 'commit_answer' post 'commit_exercise' diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 17ed37e05..25ba6e488 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1166,5 +1166,5 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;} .fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;} .mr130 {margin-right:130px;} -.mr100 {margin-right:100px;} -.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; } \ No newline at end of file +.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; } +.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;} \ No newline at end of file From c3a27151ca0fb54f2400cfa934749db7b3c0f773 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Fri, 27 Nov 2015 15:21:58 +0800 Subject: [PATCH 071/913] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=5Frevision?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_revisions.html.erb | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index 50c973fb4..b72a05876 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,16 +1,16 @@ <%= form_tag( {:controller => 'repositories', :action => 'diff', :id => project, :repository_id => @repository.identifier_param, :path => to_path_param(path)}, - :method => :get + :method => :get ) do %> - - - - - - + + + + + + @@ -24,6 +24,7 @@ <%= textilizable(truncate_at_line_break(changeset.message)) %> +
        <%= h truncate(changeset.short_id.to_s, :length => 20) %>
        @@ -31,13 +32,29 @@ @@ -50,7 +67,7 @@

          - <%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true%> + <%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
        <% end %> From 3abc3f7af0c226137edf7c69893b385275d8e75c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 15:25:49 +0800 Subject: [PATCH 072/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C=E8=BF=94=E5=9B=9E=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_document_comments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 776bd132d..02527bdfc 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -39,7 +39,7 @@ class OrgDocumentCommentsController < ApplicationController end respond_to do |format| format.html { - if params[:flag] == 0 + if params[:flag].to_i == 0 redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id) else redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id) From e3e0f4ab3798cb2f84e6845e5a3b22c5d661cccd Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 16:00:43 +0800 Subject: [PATCH 073/913] =?UTF-8?q?=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=8A=A8+?= =?UTF-8?q?=E5=8F=B7=E6=98=BE=E7=A4=BA=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_tool_expand.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index 9a36b8efb..e032496ea 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -30,7 +30,7 @@ <% if show_nav?(course_feedback_count) %> <% end %> <% if show_nav?(course_poll_count) %> From 580cc6b8d8160b969103859078617139de5075b1 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 Nov 2015 16:14:42 +0800 Subject: [PATCH 074/913] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/schema.rb b/db/schema.rb index 8e2082b37..504052365 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1151,6 +1151,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" + t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From 89d01679a7fe1301632fcecac25bf503c7c28981 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 16:27:23 +0800 Subject: [PATCH 075/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=92=8C=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 45 +++++++++++--------- app/views/layouts/base_org.html.erb | 4 +- app/views/organizations/join_courses.js.erb | 2 +- app/views/organizations/join_projects.js.erb | 2 +- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index ba4dda939..b326051e6 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -161,7 +161,7 @@ class OrganizationsController < ApplicationController def more_org_projects @organization = Organization.find params[:id] @page = params[:page] - @org_projects = @organization.projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5) + @org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5) respond_to do |format| format.js end @@ -170,7 +170,7 @@ class OrganizationsController < ApplicationController def more_org_courses @organization = Organization.find(params[:id]) @page = params[:page] - @org_courses = @organization.courses.reorder('created_at').page((params[:page].to_i || 1) + 1 ).per(5) + @org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5) respond_to do |format| format.js end @@ -189,16 +189,17 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - #sql = "select courses.* from courses inner join members on courses.id = members.course_id inner join org_courses on courses.id = org_courses.course_id where org_courses.organization_id != #{@organization.id} and members.user_id = #{User.current.id} and courses.name like '#{condition}'" - sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'" - user_courses = Course.find_by_sql(sql) - @added_course_ids = @organization.courses.map(&:id) - @courses = [] - user_courses.each do |course| - if !@added_course_ids.include?(course.id) - @courses << course - end - end + sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+ + "and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})" + #user_courses = Course.find_by_sql(sql) + @courses = Course.find_by_sql(sql) + # @added_course_ids = @organization.courses.map(&:id) + # @courses = [] + # user_courses.each do |course| + # if !@added_course_ids.include?(course.id) + # @courses << course + # end + # end end def join_courses @@ -225,15 +226,17 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" - user_projects = Course.find_by_sql(sql) - @added_course_ids = @organization.projects.map(&:id) - @projects = [] - user_projects.each do |project| - if !@added_course_ids.include?(project.id) - @projects << project - end - end + sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" + + " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})" + #user_projects = Course.find_by_sql(sql) + @projects = Course.find_by_sql(sql) + # @added_course_ids = @organization.projects.map(&:id) + # @projects = [] + # user_projects.each do |project| + # if !@added_course_ids.include?(project.id) + # @projects << project + # end + # end end def join_projects diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index b89977b09..b071a7c3b 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -104,7 +104,7 @@
          - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%> @@ -131,7 +131,7 @@
          - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%>
        diff --git a/app/views/organizations/join_courses.js.erb b/app/views/organizations/join_courses.js.erb index 1c234704e..643af161f 100644 --- a/app/views/organizations/join_courses.js.erb +++ b/app/views/organizations/join_courses.js.erb @@ -1,5 +1,5 @@ $("#homepageLeftMenuCourses").html(""); $("#homepageLeftMenuCourses").append("
          "); $("#homepageLeftMenuCourses").append("<%= escape_javascript(render :partial => 'layouts/org_courses', - :locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>"); + :locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=> 1}) %>"); $("#homepageLeftMenuCourses").append("
        "); \ No newline at end of file diff --git a/app/views/organizations/join_projects.js.erb b/app/views/organizations/join_projects.js.erb index 1db8021bf..a39d94819 100644 --- a/app/views/organizations/join_projects.js.erb +++ b/app/views/organizations/join_projects.js.erb @@ -1,5 +1,5 @@ $("#homepageLeftMenuProjects").html(""); $("#homepageLeftMenuProjects").append("
          "); $("#homepageLeftMenuProjects").append("<%= escape_javascript(render :partial => 'layouts/org_projects', - :locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>"); + :locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=> 1}) %>"); $("#homepageLeftMenuProjects").append("
        "); \ No newline at end of file From 06ca4c8f4ba6c99209ac321afb5518df64e91069 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 Nov 2015 16:52:28 +0800 Subject: [PATCH 076/913] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index faffee4d1..00aff2195 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -64,7 +64,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} a.hworkExport {background:url(../images/homepage_icon2.png) -10px -401px no-repeat; padding-left:23px;} a.hworkSetting {background:url(../images/homepage_icon2.png) -10px -450px no-repeat; padding-left:23px;} .hworkInfor {font-size:12px; color:#269ac9; width:80px; height:40px; vertical-align:middle; float:left; line-height:40px; text-align:center; font-weight:bold;} -.infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:-24px;margin-left: 40px;} +.infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:-24px;margin-left: 40px; z-index:99;} .problemTxt {width:660px; margin-left:10px; color:#777777; position:relative;} .rTxtTit{width:560px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#269ac9; font-size:14px;} .hworkSearchBox {border:1px solid #e6e6e6; width:185px; float:left; background-color:#ffffff;} From b130b52a23ada16fd441f5c0d8384211540865a4 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 16:55:45 +0800 Subject: [PATCH 077/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20151127011351_add_course_contributor_total_score.rb | 2 +- db/schema.rb | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/db/migrate/20151127011351_add_course_contributor_total_score.rb b/db/migrate/20151127011351_add_course_contributor_total_score.rb index 2606864d8..28ce55ef4 100644 --- a/db/migrate/20151127011351_add_course_contributor_total_score.rb +++ b/db/migrate/20151127011351_add_course_contributor_total_score.rb @@ -14,7 +14,7 @@ class AddCourseContributorTotalScore < ActiveRecord::Migration message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1 common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1 # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5 - attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5 + attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id} and container_type ='Course'").count * 5 journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1 # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1 # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1 diff --git a/db/schema.rb b/db/schema.rb index 603ca6857..87342bf9c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -605,7 +605,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercise_questions", :force => true do |t| - t.string "question_title" + t.text "question_title" t.integer "question_type" t.integer "question_number" t.integer "exercise_id" @@ -634,7 +634,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercises", :force => true do |t| - t.string "exercise_name" + t.text "exercise_name" t.text "exercise_description" t.integer "course_id" t.integer "exercise_status" @@ -1151,10 +1151,6 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" -<<<<<<< HEAD - t.string "role" -======= ->>>>>>> 1ae514ca4857d7e2ad53b338731c1e01f899fb4d t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From cb910b8d4ab85c7df743af3de1b5578d79f0e670 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 17:02:37 +0800 Subject: [PATCH 078/913] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index da649663d..c2b1b509f 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -411,7 +411,9 @@ <% if ma.course_message_type == "Course" %>
          -
        • +
        • + +
        • 系统提示 ">您成功创建了课程: @@ -443,7 +445,7 @@ <% end %> <% if ma.course_message_type == "JoinCourseRequest" %>
            -
          • +
          • 系统提示 ">您有了新的课程成员申请: @@ -482,7 +484,7 @@ <% end %> <% if ma.course_message_type == "CourseRequestDealResult" %>
              -
            • +
            • 系统提示 "> @@ -548,7 +550,7 @@ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
              • - +
              • 系统提示 From 634e11d0ecf6852bdbbf1ddc814b476e52e7a2a1 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 17:15:51 +0800 Subject: [PATCH 079/913] 0 --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 87342bf9c..55a97ee20 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 => 20151127011351) do +ActiveRecord::Schema.define(:version => 20151126160252) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From d9928096236dc56ca14ff6814fef3989769026c6 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 27 Nov 2015 17:19:05 +0800 Subject: [PATCH 080/913] =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 603ca6857..87342bf9c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -605,7 +605,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercise_questions", :force => true do |t| - t.string "question_title" + t.text "question_title" t.integer "question_type" t.integer "question_number" t.integer "exercise_id" @@ -634,7 +634,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercises", :force => true do |t| - t.string "exercise_name" + t.text "exercise_name" t.text "exercise_description" t.integer "course_id" t.integer "exercise_status" @@ -1151,10 +1151,6 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" -<<<<<<< HEAD - t.string "role" -======= ->>>>>>> 1ae514ca4857d7e2ad53b338731c1e01f899fb4d t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From 879dee0cd6f4ee97b8f43fa6429a991bc187e73d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 17:27:55 +0800 Subject: [PATCH 081/913] =?UTF-8?q?=E5=85=B3=E9=97=AD=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E6=88=96=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=EF=BC=8C=E5=88=B7=E6=96=B0=E6=95=B4=E4=B8=AA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_join_course_menu.html.erb | 1 + app/views/organizations/_join_project_menu.html.erb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index e66d0bcce..d875550de 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -13,6 +13,7 @@ $(".resourcePopupClose").click(function(){ + location.reload(); $(".resourceSharePopup").css("display","none"); }); }); diff --git a/app/views/organizations/_join_project_menu.html.erb b/app/views/organizations/_join_project_menu.html.erb index 765b4b23a..e13e1416e 100644 --- a/app/views/organizations/_join_project_menu.html.erb +++ b/app/views/organizations/_join_project_menu.html.erb @@ -13,6 +13,7 @@ $(".resourcePopupClose").click(function(){ + location.reload(); $(".resourceSharePopup").css("display","none"); }); }); From b6166120326338cb53e5a92d57efbc39bcd186a3 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 27 Nov 2015 17:57:17 +0800 Subject: [PATCH 082/913] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=9A=84=E8=BF=98=E5=8E=9F=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edit_head.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index b69f52a56..64f34b5aa 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -20,7 +20,7 @@ 保存 - + <%= l(:button_cancel)%> @@ -35,6 +35,6 @@ $("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>"); $("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>"); /*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/ - document.getElementById("exercise_description").innerText = <%=exercise.exercise_description.html_safe %>; + document.getElementById("exercise_description").innerHTML = <%=exercise.exercise_description.html_safe %>; } \ No newline at end of file From e9caf0980a644ec62739b16facdee31e318ed1b0 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Fri, 27 Nov 2015 17:57:43 +0800 Subject: [PATCH 083/913] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=94=A8=E6=88=B7syn?= =?UTF-8?q?c=5Fgitlab=5Fuser=EF=BC=8C=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_gitlab_user.rake | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake index c932ca36c..fb84f5f08 100644 --- a/lib/tasks/sync_gitlab_user.rake +++ b/lib/tasks/sync_gitlab_user.rake @@ -6,24 +6,30 @@ namespace :gitlab do users = User.find_by_sql("select * from users where gid is null") s = Trustie::Gitlab::Sync.new g = Gitlab.client + logger = Logger.new('./log/add_gid.log', 'daily') #按天生成 users.each do |user| - us = g.get("/users?search=#{user.mail}") - puts user.mail - if us.blank? - puts "55555555555555555" - s.sync_user(user) - else - # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com - puts "66666666666666666666" - puts user.id - if Array === us - us.each do |u| - if u.email == user.mail - user.gid = u.id - user.save + begin + us = g.get("/users?search=#{user.mail}") + puts user.mail + if us.blank? + puts "55555555555555555" + s.sync_user(user) + else + # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com + puts "66666666666666666666" + puts user.id + if Array === us + us.each do |u| + if u.email == user.mail + user.gid = u.id + user.save + end end end end + rescue => e + logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}") + puts e end end end From f91918145dfe9d42d15196d289cdaaa45ec3ac83 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 18:00:26 +0800 Subject: [PATCH 084/913] 0 --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 55a97ee20..87342bf9c 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 => 20151126160252) do +ActiveRecord::Schema.define(:version => 20151127011351) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 487c6bad0923776f37b09a98c533c182fa730f20 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 18:08:38 +0800 Subject: [PATCH 085/913] schema.rb --- db/schema.rb | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 603ca6857..6e007d6be 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -543,26 +543,23 @@ ActiveRecord::Schema.define(:version => 20151127011351) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -605,7 +602,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercise_questions", :force => true do |t| - t.string "question_title" + t.text "question_title" t.integer "question_type" t.integer "question_number" t.integer "exercise_id" @@ -634,7 +631,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do end create_table "exercises", :force => true do |t| - t.string "exercise_name" + t.text "exercise_name" t.text "exercise_description" t.integer "course_id" t.integer "exercise_status" @@ -892,6 +889,16 @@ ActiveRecord::Schema.define(:version => 20151127011351) 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" @@ -1151,10 +1158,6 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" -<<<<<<< HEAD - t.string "role" -======= ->>>>>>> 1ae514ca4857d7e2ad53b338731c1e01f899fb4d t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From ae9f1c704a4a52d26605d070a9ea59778c97daa6 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 18:36:38 +0800 Subject: [PATCH 086/913] =?UTF-8?q?500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/comment.rb | 6 ++++-- app/models/message.rb | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 9de25c50d..473283dc0 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -81,8 +81,10 @@ class Comment < ActiveRecord::Base # 课程成员得分(英雄榜) def act_as_student_score - unless self.author.allowed_to?(:as_teacher, self.commented.course) - course_member_score(self.commented.course.id, self.author_id, "NewReply") + if self.commented.course + unless self.author.allowed_to?(:as_teacher, self.commented.course) + course_member_score(self.commented.course.id, self.author_id, "NewReply") + end end end diff --git a/app/models/message.rb b/app/models/message.rb index 21e5e1c71..3f9057346 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -287,13 +287,15 @@ class Message < ActiveRecord::Base # 课程成员得分(英雄榜) def act_as_student_score - unless self.author.allowed_to?(:as_teacher, self.course) - if self.parent_id.nil? - # 发帖 - course_member_score(self.course.id, self.author_id, "Message") - else - # 回帖 - course_member_score(self.course.id, self.author_id, "MessageReply") + if self.course + unless self.author.allowed_to?(:as_teacher, self.course) + if self.parent_id.nil? + # 发帖 + course_member_score(self.course.id, self.author_id, "Message") + else + # 回帖 + course_member_score(self.course.id, self.author_id, "MessageReply") + end end end end From 27490669085c39c0b8753b701098a328be303baa Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 Nov 2015 18:43:22 +0800 Subject: [PATCH 087/913] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_sigle_rep.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake index e68e37ee8..57aaaabcb 100644 --- a/lib/tasks/sync_sigle_rep.rake +++ b/lib/tasks/sync_sigle_rep.rake @@ -9,7 +9,7 @@ namespace :sync_rep do if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git" rep = project.repositories.first count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count - puts count + puts project.id unless count > 1 rep.identifier s = Trustie::Gitlab::Sync.new From 96290ad97559cd5067aedfc5866160d0e9600c4f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 18:47:19 +0800 Subject: [PATCH 088/913] Merge branch 'szzh' into dev_zanle Conflicts: app/models/attachment.rb db/schema.rb --- app/models/course.rb | 24 +- app/models/user.rb | 34 +- db/schema.rb | 3785 +++++++++++++++++++++--------------------- 3 files changed, 1928 insertions(+), 1915 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 77850a89d..edc5e105b 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -400,19 +400,31 @@ class Course < ActiveRecord::Base # end def create_course_ealasticsearch_index if self.is_public == 1 - self.__elasticsearch__.index_document + self.__elasticsearch__.index_document end end def update_course_ealasticsearch_index - if self.is_public == 1 - self.__elasticsearch__.update_document + if self.is_public == 1 #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 + begin + self.__elasticsearch__.update_document + rescue => e + self.__elasticsearch__.index_document + end + else #如果是更新成为私有的,那么索引就要被删除 + begin + self.__elasticsearch__.delete_document + rescue => e + + end end end + def delete_course_ealasticsearch_index + begin + self.__elasticsearch__.delete_document + rescue => e - if self.is_public == 1 - self.__elasticsearch__.delete_document - end + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 17a8f32ba..cdec39a3d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -243,7 +243,7 @@ class User < Principal after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index # end # 更新邮箱用户或用户名的同事,同步更新邀请信息 - after_update :update_invite_list,:upadte_user_ealasticsearch_index + after_update :update_invite_list,:update_user_ealasticsearch_index include Trustie::Gitlab::ManageUser @@ -1161,6 +1161,23 @@ class User < Principal end end + + def create_user_ealasticsearch_index + if self.id != 2 && self.id != 4 + self.__elasticsearch__.index_document + end + end + def update_user_ealasticsearch_index + if self.id != 2 && self.id != 4 + self.__elasticsearch__.update_document + end + end + def delete_user_ealasticsearch_index + if self.id != 2 && self.id != 4 + self.__elasticsearch__.delete_document + end + end + end class AnonymousUser < User @@ -1196,21 +1213,6 @@ class AnonymousUser < User false end - def create_user_ealasticsearch_index - if self.id != 2 && self.id != 4 - self.__elasticsearch__.index_document - end - end - def update_user_ealasticsearch_index - if self.id != 2 && self.id != 4 - self.__elasticsearch__.update_document - end - end - def delete_user_ealasticsearch_index - if self.id != 2 && self.id != 4 - self.__elasticsearch__.delete_document - end - end end # Delete the previous articles index in Elasticsearch diff --git a/db/schema.rb b/db/schema.rb index dd5278d93..0d4135f3d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,4 @@ -<<<<<<< HEAD + # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to @@ -1815,1895 +1815,1894 @@ ActiveRecord::Schema.define(:version => 20151117075939) do end end -======= -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20151127011351) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - 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" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score" - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - 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 - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - 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 - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" - t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - 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 - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - end - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :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", ["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" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - 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" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end ->>>>>>> szzh +======= +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20151127011351) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + 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" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_contributor_scores", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.integer "message_num" + t.integer "message_reply_num" + t.integer "news_reply_num" + t.integer "resource_num" + t.integer "journal_num" + t.integer "journal_reply_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "total_score" + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + 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 + t.string "content" + t.integer "status" + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + 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 + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "dts", :force => true do |t| + t.string "IPLineCode" + t.string "Description" + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + 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 + t.string "secret_key" + t.integer "status" + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + end + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :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", ["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" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "is_teacher_score", :default => 0 + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + end + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + 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" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end From e728dd55ebecc33c9b2792df3c7439f2ec331543 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 19:02:07 +0800 Subject: [PATCH 089/913] Merge branch 'szzh' into dev_zanle Conflicts: app/models/attachment.rb db/schema.rb --- app/models/project.rb | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 847c536da..c68e73369 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1217,18 +1217,30 @@ class Project < ActiveRecord::Base def create_project_ealasticsearch_index - if self.is_public == 1 + if self.is_public self.__elasticsearch__.index_document end end def update_project_ealasticsearch_index - if self.is_public == 1 - self.__elasticsearch__.update_document + if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 + begin + self.__elasticsearch__.update_document + rescue => e + self.__elasticsearch__.index_document + end + else #如果是更新成为私有的,那么索引就要被删除 + begin + self.__elasticsearch__.delete_document + rescue => e + + end end end def delete_project_ealasticsearch_index - if self.is_public == 1 - self.__elasticsearch__.delete_document + begin + self.__elasticsearch__.delete_document + rescue => e + end end From 34ac56e0a0f94734e9bf861a61ebf6d5c1ce4332 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 27 Nov 2015 19:07:10 +0800 Subject: [PATCH 090/913] attachment index_document --- app/models/attachment.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index ebabbf944..aa436965b 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -612,14 +612,21 @@ class Attachment < ActiveRecord::Base if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) || ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) || self.container_type == 'Principal') + begin self.__elasticsearch__.update_document + rescue => e + end + else + begin + self.__elasticsearch__.delete_document + rescue => e + end end end def delete_attachment_ealasticsearch_index - if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) || - ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) || - self.container_type == 'Principal') + begin self.__elasticsearch__.delete_document + rescue => e end end end From 3516cde5553c138c43f5e376e6f3f0602eaf1404 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Sat, 28 Nov 2015 10:25:53 +0800 Subject: [PATCH 091/913] =?UTF-8?q?sync=5Fgitlab=5Fuser=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_gitlab_user.rake | 39 ++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake index fb84f5f08..9259353c0 100644 --- a/lib/tasks/sync_gitlab_user.rake +++ b/lib/tasks/sync_gitlab_user.rake @@ -6,32 +6,55 @@ namespace :gitlab do users = User.find_by_sql("select * from users where gid is null") s = Trustie::Gitlab::Sync.new g = Gitlab.client - logger = Logger.new('./log/add_gid.log', 'daily') #按天生成 + logger_i = Logger.new('./log/task_add_gid.log', 'daily') + logger_e = Logger.new('./log/task_add_gid_error.log', 'daily') + NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze + MAIL_REGEX_STR ='^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$'.freeze + error_cnt=0 + success_cnt=0 + p "同步Gitlab用户开始..." users.each do |user| + info="userid=#{user.id},mail=#{user.mail},login(username)=#{user.login},name=#{user.show_name}" + # username不能有特殊字符,不能有保留字符,邮箱特殊字符(比如‘>’)导致search失败的,name不能为空串 + if !(user.login =~ /\A#{NAMESPACE_REGEX_STR}\Z/.freeze) + logger_e.error("#{info},error=校验失败:username特殊字符") + error_cnt+=1 + next + elsif !(user.mail.downcase =~ /#{MAIL_REGEX_STR}/) + logger_e.error("#{info},error=校验失败:邮箱特殊字符") + error_cnt+=1 + next + elsif user.show_name.lstrip.rstrip.blank? + logger_e.error("#{info},error=校验失败:name不正常") + error_cnt+=1 + next + end begin us = g.get("/users?search=#{user.mail}") - puts user.mail if us.blank? - puts "55555555555555555" s.sync_user(user) + logger_i.info("sync_remote_user:id=#{user.id},mail=#{user.mail}") + success_cnt+=1 else - # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com - puts "66666666666666666666" - puts user.id if Array === us us.each do |u| if u.email == user.mail user.gid = u.id - user.save + # !爆炸方法抛出异常 + user.save! + logger_i.info("sync_local_user:#{info}") + success_cnt+=1 end end end end rescue => e - logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}") + logger_e.error("#{info},error=#{e}") puts e end end + p "同步Gitlab用户结束..." + p "同步成功#{success_cnt},未完成#{error_cnt}" end task :sync_members => :environment do From d67fc1898887c987dc7adc38576c815cd7df89ad Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 30 Nov 2015 10:20:47 +0800 Subject: [PATCH 092/913] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=A6=9C=E3=80=81?= =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E6=A6=9C=E6=98=BE=E7=A4=BA=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E5=A7=93=E5=90=8D=20=E4=B8=BA=E9=9B=B6=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E4=B8=8D=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_courses.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 603f7febb..c8b5a20b0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -212,7 +212,7 @@ <% contributor_course_scor(@course.id).each do |contributor_score| %> <% unless contributor_score.total_score ==0 %>
              • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %> -

                <%=link_to contributor_score.user, user_path(contributor_score.user), :title => contributor_score.user %>

                +

                <%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %>

                <%= contributor_score.total_score.to_i %>

                <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
                发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
                <% unless document.content.blank? %> -
                +
                <%= document.content.html_safe %>
                <% end %> - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
                • @@ -36,7 +32,7 @@ <% end %>
                • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 0), :class => "postOptionLink" %> + <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag), :class => "postOptionLink" %>
                • <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', diff --git a/app/views/organizations/cancel_homepage.js.erb b/app/views/organizations/cancel_homepage.js.erb new file mode 100644 index 000000000..bf9eb798c --- /dev/null +++ b/app/views/organizations/cancel_homepage.js.erb @@ -0,0 +1 @@ +window.location.href = "<%= organization_path(@org) %>"; \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index e44e0778d..9e0fc365c 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -52,14 +52,14 @@
                -<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> +<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> - <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> + <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> <% end %> <% if @org_activities %> <%= render :partial => 'organizations/org_activities', diff --git a/config/routes.rb b/config/routes.rb index d12a38425..bb6d7b940 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -36,6 +36,7 @@ RedmineApp::Application.routes.draw do get 'setting'#, :action => 'settings', :as => 'settings' get 'clear_org_avatar_temp' put 'set_homepage' + put 'cancel_homepage' get 'members' get 'more_org_projects' get 'more_org_courses' diff --git a/db/migrate/20151130032658_create_org_docume_editor.rb b/db/migrate/20151130032658_create_org_docume_editor.rb new file mode 100644 index 000000000..0dc9857ba --- /dev/null +++ b/db/migrate/20151130032658_create_org_docume_editor.rb @@ -0,0 +1,12 @@ +class CreateOrgDocumeEditor < ActiveRecord::Migration + def up + create_table :editor_of_documents do |t| + t.integer :editor_id + t.integer :org_document_comment_id + t.timestamp :created_at + end + end + + def down + end +end diff --git a/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb new file mode 100644 index 000000000..2361db3dd --- /dev/null +++ b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb @@ -0,0 +1,12 @@ +class CopyDocumentCreatedAtForEditorOfDocument < ActiveRecord::Migration + def up + OrgDocumentComment.all.each do |doc| + if doc.parent.nil? + EditorOfDocument.create(:editor_id => doc.creator_id, :org_document_comment_id => doc.id, :created_at => doc.updated_at) + end + end + end + + def down + end +end From 3750a49b6541b4201146129f905a2b66d36f6392 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 30 Nov 2015 16:10:29 +0800 Subject: [PATCH 103/913] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8B=E6=8B=89=E6=A1=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_home_page.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index ade3f7ba8..3628b4929 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -20,7 +20,7 @@ - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
                • From ebeaac5798c0668a5936a63930e6e96fbda2a1f1 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 30 Nov 2015 16:27:26 +0800 Subject: [PATCH 104/913] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E7=9A=84=E7=BB=93=E6=9D=9F=E7=8A=B6=E6=80=81=E6=9C=AA=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 1 - lib/tasks/delete_evalution.rake | 12 ++++++++++-- lib/tasks/homework_evaluation.rake | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 70b64ec7b..f19c4704f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -963,7 +963,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" diff --git a/lib/tasks/delete_evalution.rake b/lib/tasks/delete_evalution.rake index 6d01123e0..94075ae00 100644 --- a/lib/tasks/delete_evalution.rake +++ b/lib/tasks/delete_evalution.rake @@ -2,12 +2,20 @@ namespace :delete_evalution do desc "delete evaluation" task :delete => :environment do homework = HomeworkCommon.where("id = 844").first - homework.homework_detail_manual.update_column('comment_status', 3) + homework_detail_manual = homework.homework_detail_manual + homework_detail_manual.update_column('comment_status', 3) student_work_score = StudentWorksScore.where("student_work_id = 28088 and user_id = 9263").first student_work_score.destroy student_work_9203 = StudentWork.where("id = 28088").first student_work_9263 = StudentWork.where("homework_common_id = 844 and user_id = 9263").first student_work_9203.update_column("student_score",91) - student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework.homework_detail_manual.absence_penalty) + student_work_9203.update_column("final_score",91) + student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework_detail_manual.absence_penalty) + work_ids = "(" + homework.student_works.map(&:id).join(",") + ")" + homework.student_works.each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 + student_work.save + end end end \ No newline at end of file diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 84082eb9b..6be2d6a04 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -52,7 +52,7 @@ namespace :homework_evaluation do #自动关闭匿评的任务 task :end_evaluation => :environment do - homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'") + homework_detail_manuals = HomeworkDetailManual.where("evaluation_end <= '#{Date.today}'") homework_detail_manuals.each do |homework_detail_manual| homework_common = homework_detail_manual.homework_common if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评 From b16acda21e8f44bf355ac1ea5b336ca3a99a3a78 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 30 Nov 2015 17:22:03 +0800 Subject: [PATCH 105/913] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9A=82=E6=97=B6=E4=B8=8D=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/homework_evaluation.rake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 6be2d6a04..456de479b 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -65,12 +65,12 @@ namespace :homework_evaluation do end homework_detail_manual.update_column('comment_status', 3) # 匿评关闭消息通知 给所有人发 - course = homework_common.course - course.members.each do |m| - homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) - end + #course = homework_common.course + #course.members.each do |m| + # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) + #end # 邮件通知 - Mailer.send_mail_anonymous_comment_close(homework_common).deliver + #Mailer.send_mail_anonymous_comment_close(homework_common).deliver end end end From d6d0acf8bf33bd53861740d2dc7d425ffc72bc7d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 30 Nov 2015 18:07:29 +0800 Subject: [PATCH 106/913] tip --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 61f73ee3d..9e6d41abe 100644 --- a/config/application.rb +++ b/config/application.rb @@ -80,7 +80,7 @@ module RedmineApp elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n","")) - Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true else Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true end From 52a0da83c459782e4abd24682ff1b0885b9cf3ee Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 30 Nov 2015 21:52:05 +0800 Subject: [PATCH 107/913] =?UTF-8?q?=E5=8C=BF=E5=90=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=95=99=E8=A8=80=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 2 ++ app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 6cc622c49..c9c4dcce3 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -3,6 +3,8 @@ class WordsController < ApplicationController include ApplicationHelper before_filter :find_user, :only => [:new, :create, :destroy, :more, :back] + before_filter :require_login, :only => [:create_reply] + def create if params[:new_form][:user_message].size>0 && User.current.logged? unless params[:user_id].nil? diff --git a/app/models/user.rb b/app/models/user.rb index cdec39a3d..12be9b0f9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -477,7 +477,7 @@ class User < Principal end if user # user is already in local database - #return nil unless user.active? + return nil if user.locked? return nil unless user.check_password?(password) else # user is not yet registered, try to authenticate with available sources From 259cb67c5878e26d40d96256fc85ca7b26b24030 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 1 Dec 2015 09:22:01 +0800 Subject: [PATCH 108/913] =?UTF-8?q?rake=E5=91=BD=E4=BB=A4=E7=9A=84?= =?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 --- lib/tasks/delete_evalution.rake | 21 --------------------- lib/tasks/homework_evaluation.rake | 12 ++++++------ lib/tasks/homework_publishtime.rake | 2 +- 3 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 lib/tasks/delete_evalution.rake diff --git a/lib/tasks/delete_evalution.rake b/lib/tasks/delete_evalution.rake deleted file mode 100644 index 94075ae00..000000000 --- a/lib/tasks/delete_evalution.rake +++ /dev/null @@ -1,21 +0,0 @@ -namespace :delete_evalution do - desc "delete evaluation" - task :delete => :environment do - homework = HomeworkCommon.where("id = 844").first - homework_detail_manual = homework.homework_detail_manual - homework_detail_manual.update_column('comment_status', 3) - student_work_score = StudentWorksScore.where("student_work_id = 28088 and user_id = 9263").first - student_work_score.destroy - student_work_9203 = StudentWork.where("id = 28088").first - student_work_9263 = StudentWork.where("homework_common_id = 844 and user_id = 9263").first - student_work_9203.update_column("student_score",91) - student_work_9203.update_column("final_score",91) - student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework_detail_manual.absence_penalty) - work_ids = "(" + homework.student_works.map(&:id).join(",") + ")" - homework.student_works.each do |student_work| - absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count - student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 - student_work.save - end - end -end \ No newline at end of file diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 456de479b..84082eb9b 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -52,7 +52,7 @@ namespace :homework_evaluation do #自动关闭匿评的任务 task :end_evaluation => :environment do - homework_detail_manuals = HomeworkDetailManual.where("evaluation_end <= '#{Date.today}'") + homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'") homework_detail_manuals.each do |homework_detail_manual| homework_common = homework_detail_manual.homework_common if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评 @@ -65,12 +65,12 @@ namespace :homework_evaluation do end homework_detail_manual.update_column('comment_status', 3) # 匿评关闭消息通知 给所有人发 - #course = homework_common.course - #course.members.each do |m| - # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) - #end + course = homework_common.course + course.members.each do |m| + homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) + end # 邮件通知 - #Mailer.send_mail_anonymous_comment_close(homework_common).deliver + Mailer.send_mail_anonymous_comment_close(homework_common).deliver end end end diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 8e231fafd..5eaeb37cb 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -22,7 +22,7 @@ namespace :homework_publishtime do end task :end => :environment do - homework_commons = HomeworkCommon.where("end_time < '#{Date.today}'") + homework_commons = HomeworkCommon.where("end_time = '#{Date.today}'") homework_commons.each do |homework| if homework.anonymous_comment == 1 homework_detail_manual = homework.homework_detail_manual From b2bca65025799a659114a92206526cb2362fccd5 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 10:33:57 +0800 Subject: [PATCH 109/913] =?UTF-8?q?=E5=88=86=E7=89=87=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 2 +- app/models/course.rb | 2 +- app/models/project.rb | 2 +- app/models/user.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index aa436965b..999cefdaa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -43,7 +43,7 @@ class Attachment < ActiveRecord::Base #elasticsearch kaminari init Kaminari::Hooks.init Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari - settings index: { number_of_shards: 1 } do + settings index: { number_of_shards: 5 } do mappings dynamic: 'false' do indexes :filename, analyzer: 'smartcn',index_options: 'offsets' indexes :downloads, analyzer: 'smartcn',index_options: 'offsets' diff --git a/app/models/course.rb b/app/models/course.rb index edc5e105b..30a6bb439 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -12,7 +12,7 @@ class Course < ActiveRecord::Base #elasticsearch kaminari init Kaminari::Hooks.init Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari - settings index: { number_of_shards: 1 } do + settings index: { number_of_shards: 5 } do mappings dynamic: 'false' do indexes :name, analyzer: 'smartcn',index_options: 'offsets' indexes :description, analyzer: 'smartcn',index_options: 'offsets' diff --git a/app/models/project.rb b/app/models/project.rb index c68e73369..ff546e098 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -35,7 +35,7 @@ class Project < ActiveRecord::Base #elasticsearch kaminari init Kaminari::Hooks.init Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari - settings index: { number_of_shards: 1 } do + settings index: { number_of_shards: 5 } do mappings dynamic: 'false' do indexes :name, analyzer: 'smartcn',index_options: 'offsets' indexes :description, analyzer: 'smartcn',index_options: 'offsets' diff --git a/app/models/user.rb b/app/models/user.rb index cdec39a3d..e043a5ff9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class User < Principal #elasticsearch kaminari init Kaminari::Hooks.init Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari - settings index: { number_of_shards: 1 } do + settings index: { number_of_shards: 5 } do mappings dynamic: 'false' do indexes :login, analyzer: 'smartcn',index_options: 'offsets' indexes :firstname, analyzer: 'smartcn',index_options: 'offsets' From 0aba11f175e767f186890f7ec5bcc9c3f0f02b79 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 1 Dec 2015 11:28:33 +0800 Subject: [PATCH 110/913] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=9C=A8360=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/setting.html.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 82b28fb8a..96fef706a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -45,13 +45,11 @@ <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %> -
                  组织名称: - +
                  组织名称:
                  -
                  组织描述: - +
                  组织描述:
                  From 68a29d813157db74396dbd934d92f2449361306b Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 1 Dec 2015 15:18:14 +0800 Subject: [PATCH 111/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=90=8E=E5=8F=AF=E7=82=B9=E5=87=BB=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E9=87=8D=E6=96=B0=E4=B8=8A=E4=BC=A0=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 23 ++++++++++++++++--- .../student_work/_work_information.html.erb | 3 ++- app/views/student_work/create.js.erb | 2 +- app/views/student_work/new.html.erb | 4 ++-- app/views/student_work/retry_work.js.erb | 2 ++ config/routes.rb | 2 ++ 6 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 app/views/student_work/retry_work.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d2aba1386..dd2a5b5fc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,8 +3,8 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment] - before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work] + before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment] @@ -222,7 +222,7 @@ class StudentWorkController < ApplicationController def edit @user = User.current - if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 + if (!User.current.admin? && @homework.homework_type == 2) || Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业 render_403 else respond_to do |format| @@ -284,6 +284,23 @@ class StudentWorkController < ApplicationController end end + def delete_work + @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first + if @work + @work.destroy + end + redirect_to user_homeworks_user_path(User.current.id) + end + + def retry_work + if @work.destroy + @student_work = StudentWork.new + respond_to do |format| + format.js + end + end + end + #添加评分,已评分则为修改评分 def add_score @is_last = params[:is_last] == "true" diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index f8a55a03d..90d749af1 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -19,9 +19,10 @@

                  - + 确  定 + <%= link_to("重试", retry_work_student_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
                  diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index afd8617aa..67a1ccb50 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -11,7 +11,7 @@ showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + - ""); + ""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("anonymos"); <% else %> diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 4f9999277..45c26654e 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -111,9 +111,9 @@
                - 确定 + 提交 - <%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%> + <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
                <% end%> diff --git a/app/views/student_work/retry_work.js.erb b/app/views/student_work/retry_work.js.erb new file mode 100644 index 000000000..c5fca76d4 --- /dev/null +++ b/app/views/student_work/retry_work.js.erb @@ -0,0 +1,2 @@ +hideModal('#popbox02'); +$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false})%>"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index bfe62bc3f..f6fe95a33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,11 +206,13 @@ RedmineApp::Application.routes.draw do resources :student_work do member do post 'add_score' + get 'retry_work' get 'praise_student_work' get 'forbidden_anonymous_comment' end collection do post 'add_score_reply' + get 'delete_work' get 'destroy_score_reply' get 'student_work_absence_penalty' get 'absence_penalty_list' From 304cc078a74dac906178e418a01c0900fe41e2be Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 15:30:47 +0800 Subject: [PATCH 112/913] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AD=A6=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E6=84=9F=E5=8F=B9=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index c2b1b509f..6e8fda92e 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -126,7 +126,7 @@
              <% end %> -
            •    截止时间快到了!
            • +
            •    截止时间快到啦
            • <%= time_tag(ma.created_at).html_safe %>
            <% end %> @@ -158,7 +158,7 @@
          • 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %>  23:59
          <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%> -

          请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

          +

          请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

          例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分

          <% end%> @@ -209,7 +209,7 @@ -
        •   您迟交了作品!
        • +
        •   您成功提交了作品(但被标记为迟交啦)
        • <%= time_tag(ma.created_at).html_safe %>
        <% end %> From d4823e7c8b606fac2cf8d81c1d8501670c20dd06 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 15:48:25 +0800 Subject: [PATCH 113/913] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_show_topics.html.erb | 2 +- app/views/memos/show.html.erb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index bb8a91b69..dc3a20482 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -16,7 +16,7 @@
        最后回复:<%= author.name%>
        <%= format_date(topic.last_reply.created_at)%>
        <% end%> - + 更新时间:<%= format_date(topic.updated_at)%>
        diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index efcd15a66..c05b63427 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -79,6 +79,8 @@ <%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> <% end %>
        +
        + 更新时间:<%= format_date(@memo.updated_at)%>
        From 35b543cd22ad41fb7cd8e2c562f2901bf1d757f0 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 17:23:14 +0800 Subject: [PATCH 114/913] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E5=8F=91=E5=B8=96=20?= =?UTF-8?q?=E9=87=87=E7=94=A8ajax=E6=8F=90=E4=BA=A4=E3=80=82=E8=BF=99?= =?UTF-8?q?=E6=A0=B7=E5=AD=90=E7=BD=91=E7=BB=9C=E4=B8=8D=E5=A5=BD=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E5=B0=B1=E4=B8=8D=E4=BC=9A=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 6 +++++- app/views/forums/show.html.erb | 18 ++++++++++++++++-- app/views/layouts/base_forums.html.erb | 2 +- app/views/memos/create.js.erb | 1 + app/views/memos/edit.html.erb | 16 +++++++++++++++- app/views/memos/update.js.erb | 5 +++++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 app/views/memos/create.js.erb create mode 100644 app/views/memos/update.js.erb diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 4181090a5..2d2c058d4 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -73,6 +73,7 @@ class MemosController < ApplicationController end end #end + format.js format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else @@ -152,6 +153,7 @@ class MemosController < ApplicationController end def update + @flag = false respond_to do |format| if( #@memo.update_column(:subject, params[:memo][:subject]) && @memo.update_column(:content, params[:memo][:content]) && @@ -159,10 +161,12 @@ class MemosController < ApplicationController @memo.update_column(:lock, params[:memo][:lock]) && @memo.update_column(:subject,params[:memo][:subject])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) - @memo.save + @flag = @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) + format.js format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"} else + format.js format.html { render action: "edit" } format.json { render json: @person.errors, status: :unprocessable_entity } end diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 05c086ed4..ad9195804 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -3,7 +3,7 @@
        diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index efaed2d9d..cfc098645 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -97,7 +97,7 @@
        - + diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index c2b1b509f..6e8fda92e 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -126,7 +126,7 @@ <% end %> -
      •    截止时间快到了!
      • +
      •    截止时间快到啦
      • <%= time_tag(ma.created_at).html_safe %>
      • <% end %> @@ -158,7 +158,7 @@
      • 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %>  23:59
      • <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%> -

        请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

        +

        请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

        例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分

        <% end%> @@ -209,7 +209,7 @@ -
      •   您迟交了作品!
      • +
      •   您成功提交了作品(但被标记为迟交啦)
      • <%= time_tag(ma.created_at).html_safe %>
      • <% end %> diff --git a/config/application.rb b/config/application.rb index 61f73ee3d..9e6d41abe 100644 --- a/config/application.rb +++ b/config/application.rb @@ -80,7 +80,7 @@ module RedmineApp elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n","")) - Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true else Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true end diff --git a/db/schema.rb b/db/schema.rb index c6ca6a0ce..442ceaab9 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 => 20151130033906) do +ActiveRecord::Schema.define(:version => 20151202064455) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -735,6 +738,17 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + create_table "homework_detail_manuals", :force => true do |t| t.float "ta_proportion" t.integer "comment_status" @@ -891,16 +905,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) 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" diff --git a/public/images/course/hwork_icon.png b/public/images/course/hwork_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..82c78ac60defdaafaf7e2e8c55530e6939b5b86f GIT binary patch literal 4494 zcmb_g2UJtpx<<#LS+D^L48(vKYDj?4g@h!)AfbqWR3QWikOY!o=-B8*PyqphGbkuV zKuV1CQA9x6pfr(yG%2AdAidl$>dd_N?z;EgweDG`{AaKK``iBZzxFw?78s-bf?|R^ zJUshNjFDE{Cz*Rq@bhx-s(>eU+{bY$%8q)LNbx`EnU0|Xq^6%a`9B~r8l^?-la)#l1O z!(brb4;8A99`I{Wc4ig;LlPMWP*+w}!m2Wd^{0|+=G)dZ;r)I_Li!Zg)XU} z+GrG9)ewe6YH6V15C}>gp{}NaRzs<(YH7mZS{fSPu_i0^pCj zYUBTjf4Bxz1*!%|7;0*1a1(}TqP1Ws6*LT?u7cKpXc+>(Vcq|eT7kJifOp97H*$O* z;xcYW{FCb3mp>N^j>ughWbRT3Jtn%ByFA-WkZ|k3zG-?$f@6< z(%QMoi}XF?mYLVel1$e4h=_A*myCrYEbe{aR>r2u24j{PHfC}; zvB{b80zb|_{J~p%|{GROG=I*0~ zFW|C?Oi$?osn$}=+QW%$q?Bs))w-T@xtTLAltYEMXWqAur;<{ z>EfL;sHl*1hw1aqUt~=@i41x4uSi1c=NdZp@XY z%1bN7=KB5oHA|6IOm7j#Jb$NPI`O1l{za$B_FIFmCkM}M11i&Cd-^xM_P0dV`|8MI z?u|BWF*9lEBv?Pg9bAtX?m`Okouu1OJ$uAtZP=m2iZjmyX(Jr-U;N&s1~qb19V#ZX zuT@F?^f4OOp9}+1cMb zrCe%R`1*{7EK^Ya_>Ib$)Y8irGO}fK_-ULdfN9#<$z&iT(>}{7@7`V(EBb--NL6)j zL`s^NM0~?Lx8>+X-FnjjLCdQz&dFbX#ImBBHg1(NtJ!Ypt#-x5zn*g6R5JZRbH#hX zx`79{3%NUH&q0BduhKOxJ^!bK_=B=Mz!Trd`g6MyZk(o!i?>wMpzzT-&_^*=qHR*z?zsvhbMOXMql-X0|Ge||r-`=94X0_-A5N{w zLzC|Lw=d6PhP_@aTs7cKyNEN#=&4h^F*l%6B5`xxtSmYi_u-XV(p`_@$`x#pFD?ZP zR;RVnZn!<3DM-{bjamr*9ICo@G00?pb=VU>tokBYac_lBh45Rmd%2aK@0&Kmt{dMA zF!Ow;fM~Qy%X^ukb!6>%AJdp1-8hz)EAh+op`qMVv^0~~_MD9jL7}Ue-q{kJodZ%; zClFfu1`-2(pPv;K@)h!-%v?Kg{ph%hofkSxR4#X4u2rs@iT&$^euByCS6-&wD^@`@ zl|LdXyY4%lR#QF)8XTOLmA-efS&$tWP}yfuZ#(O3*Kg3xhQ7dNY$-4gn5k7*&)-+D z@Et_0Ns#?J!=j`+PhBj^aexPHx*Zde=VME^{b-Y`AFT_5*H=D7d~tHec}?V{Ry-tI z%VVc(GcT zzc=)Y?zTa|woc&?n0}1@uI=Z|<0tAjY($Uq)_`~?dvzK%s%Kw;e6Z52^xHbN*RS3v zdL^_^Br5PKK3CQ$t^~Jb$0!1hKajmUJi+jP?F$+_;;&Jmte86B#6Ddp+a9_tK7-!8 zHGgXeQg(mif?8rl^a@th;rwW+=oFuey|=#3;owuL$%Le;OA4JFlDJf_e)2++u73G^ zYIW)cMK@}y9#i58S`=Nu8m-CSh^|Eqg8Rirub>JY<)+Z>NIIsed91nIaVs?6@pRS2 zcWZYi%5=bac*lXMLt5+vJ|H37V!qlzXn&+*Cz7h&1$LRfUtdxbwY2}5d4E;G;x0*G ze#R75aZ@#HuoPRO7@LE+`5?J-rYvSWR^WO%#_1Kl^I3?V9Qeajx9Mv6M_jXQ!EAVn zF0ZU7$7y&i8>9R*pFY)+UM*R)dV-Rk>{6MC9Clugki^gUmD{a>MAZ_laF?`ax}BAS z6HGT8nMo5*Ru&Lq^p_o%6Bzc>G90#Y)1IGaD{zlPMcdWi-0gF2((|u*TF3sak=;+q z&ypP0`q=)&08=nYxAds1iI+J3e#<&7SIEfHwlc^K=jBcgq^=_$ICGB1jj3j|Z9zv? z`L@&R$zvT))cnF3@m1L6568`8NoLGpK2L4`7CGx0pT~=fiCx18>F!g4HIME(67_z= zThLTFQpfgPuf@^%S@FFRABv>@-fVW-&e#6+UD_OuGve1>@5iQRE1bkH^-n*Sx|6lt zdTT?xu{i=i{Zn+!v7>RV6EE=c4+wFa(E5@ylrO^J+Z_F+F(kafzGkmjGUa>-m_0!0*qSB%JvbKt)OTNhfyyr$bB0j$9tl))z!5?aZynhAqRNf z+tS1le_4{{o8(vrmWGGt67SgSFnH(a-JE`iPR}QDRJxY}@;65s9Z8c(O=<9;ZZ*eR z{792EaGUOMe5~ivJ2JZ{7~YHt=MbH<2Y-*z4fA%}Y_5ytC;6w8%iCB|T(@r5YElNh zPQ2Hk?-BBeo9(n-FI3#O$-C{bZIZQd@Wz}vg%sHOC<%XZFL{P~zzkv5FrOxYYoNRc zAN3Urx49{?Y!bm1T{P(tg&{{*3LohdhP6i1Go2^ePy&SX*_I>NMuh`ap?=#3PktE_ zYNL~?1{eA}lGkDgN)auKNaAcv|4s8At10aOXV|i zPT6zM>R?J=-td{|d)eoEl^Ts^hklHbh)Wa~3K{2>Ft>S`jhkU}oW~+J*Xfs6eK=yT z`qF&Fd%D=iMg_!|F_?b-6n}i9auyh9!_ ztG}XqbHmjn##msojc1#+%XO>X51cH1;!Oag3G0@pIz1%hJIe^^w1d6argO=;_!-T77=e zV@V&6C2IhPaeg~8ES%b|!djZt{3VIuy-NADk0)g|zND-Qw%DQBMf3Z)T9yBbWu1%a zG0F9op@s#2-fAE7 zUUP`IMx~%cZQ0*rP4ZOX&xl8vcFZE&q6K<5;c3pR0!p}{mCuc-YD#>ok=RcZ)~G*J zl`*b3;WzQwJ3|tbYa0DvYO+W{xT>~m>KeUm^>93AG*lnolU{qiMObpEU9b8)ir2R| ze=ORwq~GvRKAWR(S2v@59JGl*%#Sp~Xhp(PpUyiqI+)!V@l7|)!LV;f^yRe}ZY+te z>s+7CyvrzfNn3x;Aq{O{uD*X7W@xmR>RKG43mZ5=8)n#NvB{~;6p(zcTFnDJjR4P1 zyi|Z{Mk|O6I=aPBST!#zU}eRpn_5n_fs59bJ_irivf$;l4+v!{N`HOFE_}d-WH<}lCu$?yITf1)0Vbwl;R#foTy{ueQzanEf zE*CLN@f>&Oh|u7X#TIusH}nrXywgD`g}e>v_Y90fD=7&r=`qt@Z1fm0>KwzHOdm9t z`@lhCcO@hq%3OvBc~1%#YF^<-*+-tux|mP~{3-pjG!9&eDQr^=hBq|fGZ=4E>EX~r z8PlZTb>2dYDC6tOHMn|F%<#K^-}rXg;{V#r{oidJLMHRSzvKJfdcQX2@9p^i5zEfE m&`vo2Zj1TMe#_y~E}nVbXZnw;Ok{WdkeHw_$U?-0EB^qHH0+cB literal 0 HcmV?d00001 diff --git a/public/images/course/right-arrow.png b/public/images/course/right-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..b152e9ce9f65165d57377cb50087c2a5ede4f311 GIT binary patch literal 1325 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRs!3HE%f6fyGQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?=ezLn2Bde0{8v^Kf6`()~Xj@TAnpKdC8`Lf!&sHg;q@=(~U%$M( zT(8_%FTW^V-_X+15@d#vkuFe$ZgFK^Nn(X=Ua>OF1ees}t-3#_`hBq$Z(46Le)Ln;eW^@CE2 z^Gl18f$@>14ATq@JNy=b6armi<&vLVnwy$e;^|_m1QgLr$xN{_cXl-~GjTJuw6HWb zG;}q!Ff(&@c6KqcGGjMjE=kNwPKD{sMCdiatJli8C^fMpzbGU>KL-|j z0U7xv`NbLe1q#l=W(wh%c`5nj#h`$Nx-+#Xvn(~mttdZN0UR<`nMk&~S{j>}nz*=` z7`Pc5I~h1TyBfQhIGI?w8oC&onV7gKLG`2{`Iev_eW2y~plC#jR+tblt$>*DL<;1< zlX+?$Fl`qB6Y-fD5;+VEjGH}O978H@EtzWT&Fm=9_T7n#Q-hJUHR4#kg4v>04y79^ zT}g{rnmZB_pP%0#?DB~HQM$0SD@$NN&Xr3>Ym*kX%+U~YstJ3iBDcMGr^SbqzLfjr z<>}wmrsdxD_gd*aqxpN*)>S1D)0V#K?Pd)LL6QkIJ;0Vw8o9DLV^Ga-RJyqPAdvMA0kd`GcmEIn<>CbQS?3X*9 zJpHA}mXka?b*?OlzAqd$dyCf8uFL?wu!ScpS|*-wp2Gih-=TR+SN)H98W=GxE&XTt zk}3C1<(j`Xn17Pnv}V&2Q;FxNogDmkq<+)c`Q+{)lSjUuJs;X;EsZT)>&UlpU4@T8 z{A9HU7o(3vMoc_%L^Ng3Bl+ZAMKfq ew!is*#1a_(E}x^jPDLDCf_b|7xvX Date: Thu, 3 Dec 2015 18:33:08 +0800 Subject: [PATCH 127/913] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E8=AE=A2?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_revise_attachments.html.erb | 30 +++++++++++++++++++ app/views/student_work/_show.html.erb | 25 ++++++++++++++++ .../20151203030635_add_attachment_type.rb | 9 ++++++ db/schema.rb | 2 +- public/stylesheets/courses.css | 5 ++++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 app/views/student_work/_revise_attachments.html.erb create mode 100644 db/migrate/20151203030635_add_attachment_type.rb diff --git a/app/views/student_work/_revise_attachments.html.erb b/app/views/student_work/_revise_attachments.html.erb new file mode 100644 index 000000000..1321da368 --- /dev/null +++ b/app/views/student_work/_revise_attachments.html.erb @@ -0,0 +1,30 @@ +
        +
        + + 上传附件 + <%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %> + <%= file_field_tag 'attachments[dummy][file]', + :id => "_file#{work.id}", + :class => 'file_selector', + :multiple => true, + :onchange => "addReviseFiles(this, '#{work.id}');", + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all), + :containerid => "#{work.id}" + } %> + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
        + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 1b0202536..894f9fb39 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -61,6 +61,31 @@ + + <%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%#= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
        <%student_work_scores.each do |student_score|%>
        diff --git a/db/migrate/20151203030635_add_attachment_type.rb b/db/migrate/20151203030635_add_attachment_type.rb new file mode 100644 index 000000000..2c41aa5f2 --- /dev/null +++ b/db/migrate/20151203030635_add_attachment_type.rb @@ -0,0 +1,9 @@ +# encoding: utf-8 +class AddAttachmentType < ActiveRecord::Migration + def up + Attachmentstype.create(typeId:3,typeName:'修订附件') + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 442ceaab9..a7e3224d2 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 => 20151202064455) do +ActiveRecord::Schema.define(:version => 20151203030635) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 57838bdba..584a49a4f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1192,3 +1192,8 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no- .addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} .rightArrow {margin:50px 15px 0px 15px; float:left;} .relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} + +.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;} +.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;} +a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} +a:hover.blueCir{ background:#3598db; color:#fff;} From 838140ada86ec067f2df122edc0441c90b7ba016 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Dec 2015 19:08:15 +0800 Subject: [PATCH 128/913] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8F=91=E5=B8=83=E5=92=8C=E6=88=AA?= =?UTF-8?q?=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 16 ++++++++++++++++ lib/tasks/exercise_publish.rake | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 lib/tasks/exercise_publish.rake diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6d6d429b6..0c794fe33 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -6,6 +6,14 @@ class ExerciseController < ApplicationController include ExerciseHelper def index + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + end_exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end if @course.is_public == 0 && !User.current.member_of_course?(@course) render_403 return @@ -24,6 +32,14 @@ class ExerciseController < ApplicationController end def show + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + end_exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end unless User.current.member_of_course?(@course) render_403 return diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake new file mode 100644 index 000000000..aacd67c1f --- /dev/null +++ b/lib/tasks/exercise_publish.rake @@ -0,0 +1,18 @@ +#coding=utf-8 + +namespace :exercise_publish do + desc "publish exercise and end exercise" + task :publish => :environment do + exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end + + task :end => :environment do + exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end + end +end From 4e9e7543baa592c5f2704c7195539a43a5051852 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Dec 2015 19:21:35 +0800 Subject: [PATCH 129/913] =?UTF-8?q?chrome=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BF=9D=E5=AD=98=E6=B5=8B=E9=AA=8C=E5=A4=B4?= =?UTF-8?q?=E9=83=A8=E4=BF=A1=E6=81=AF=E6=97=A0=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edit_head.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 64f34b5aa..a071904ce 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -35,6 +35,5 @@ $("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>"); $("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>"); /*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/ - document.getElementById("exercise_description").innerHTML = <%=exercise.exercise_description.html_safe %>; } \ No newline at end of file From b91c65798d5a576e3e89fe0b20cdd75324be7d12 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:44:29 +0800 Subject: [PATCH 130/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index ce336373b..08cf27f17 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,5 +1,8 @@
        -

        <%= @subPage_title%>

        +

        <%= @subPage_title%>

        +
        + <%= link_to "修改角色", url_for(:controller => 'courses', :action => 'settings', :id => @course.id) %> +
        <% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> From 8d891a9faa93c5ccbdd04e7773e7560cb93b9dd6 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:57:09 +0800 Subject: [PATCH 131/913] =?UTF-8?q?fork=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 9601e5188..7cd93f5b0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,7 +25,10 @@ -
        Fork 0
        + <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> + <% if User.current.id != @project.user_id || User.current.projects.count !=0 %> +
        Fork 0
        + <% end %>
        <% if @changesets && !@changesets.empty? %> From 057d9a33371de1decdf7edf48d4beb869d652969 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 00:15:47 +0800 Subject: [PATCH 132/913] 0 --- app/controllers/courses_controller.rb | 76 +++++++++++++-------------- app/views/courses/settings.html.erb | 24 ++++----- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cd1de16fc..6c275850b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -55,11 +55,11 @@ class CoursesController < ApplicationController def join if User.current.logged? - cs = CoursesService.new - @user = User.current - join = cs.join_course params,@user - @state = join[:state] - @course = join[:course] + cs = CoursesService.new + @user = User.current + join = cs.join_course params,@user + @state = join[:state] + @course = join[:course] # else # @course = Course.find_by_id params[:object_id] # CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest') @@ -70,7 +70,7 @@ class CoursesController < ApplicationController end @object_id = params[:object_id] respond_to do |format| - format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } + format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } end end @@ -85,7 +85,7 @@ class CoursesController < ApplicationController end end - + def join_private_courses respond_to do |format| format.js @@ -98,14 +98,14 @@ class CoursesController < ApplicationController c = cs.edit_course params,@course,User.current @course = c[:course] if @course.errors.full_messages.count <= 0 - respond_to do |format| - format.html { - # render :layout => 'base_courses' - flash[:notice] = l(:notice_successful_update) - redirect_to settings_course_url(@course) - } - format.api { render_api_ok } - end + respond_to do |format| + format.html { + # render :layout => 'base_courses' + flash[:notice] = l(:notice_successful_update) + redirect_to settings_course_url(@course) + } + format.api { render_api_ok } + end else respond_to do |format| format.html { @@ -134,8 +134,8 @@ class CoursesController < ApplicationController courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc") @courses = paginateHelper courses,10 end - @name = params[:name] - @type = 'courses' + @name = params[:name] + @type = 'courses' respond_to do |format| format.html { render :layout => 'course_base' @@ -277,7 +277,7 @@ class CoursesController < ApplicationController def member ## 有角色参数的才是课程,没有的就是项目 if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - + @render_file = 'new_member_list' @score_sort_by = "desc" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @@ -312,7 +312,7 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; - + respond_to do |format| format.xls { send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", @@ -426,7 +426,7 @@ class CoursesController < ApplicationController end def course - @school_id = params[:school_id] + @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? @courses_all = Course.active.visible. @@ -514,8 +514,8 @@ class CoursesController < ApplicationController def index if !User.current.admin? - render_404 - return + render_404 + return end @course_type = params[:course_type] @school_id = params[:school_id] @@ -564,7 +564,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'base' } format.atom { courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all @@ -683,10 +683,10 @@ class CoursesController < ApplicationController end def feedback - @course.journals_for_messages.each do |messages| - query = messages.course_messages.where("user_id = ?", User.current.id) - query.update_all(:viewed => true); - end + @course.journals_for_messages.each do |messages| + query = messages.course_messages.where("user_id = ?", User.current.id) + query.update_all(:viewed => true); + end if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) page = params[:page] @@ -737,20 +737,20 @@ class CoursesController < ApplicationController #从课程创建的老师那里选择课程大纲 def course_outline - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles - @is_in_show_outline_page = params[:is_in_show_outline_page] - respond_to do |format| - format.js - end + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles + @is_in_show_outline_page = params[:is_in_show_outline_page] + respond_to do |format| + format.js + end end #根据关键字搜索,查找方法一样的,但返回内容不一样 def search_course_outline - @article_title = params[:title] - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles.like(@article_title) - render :json=>@blog_articles.to_json + @article_title = params[:title] + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles.like(@article_title) + render :json=>@blog_articles.to_json end #设置或者更改课程的大纲 @@ -796,7 +796,7 @@ class CoursesController < ApplicationController def can_show_course @first_page = FirstPage.find_by_page_type('project') if @first_page.try(:show_course) == 2 - render_404 + render_404 end end diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 5c3918f00..ce56537c1 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -107,15 +107,15 @@
        + function select() { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } + $("#time_selected").click(select); + $("#term_selected").click(select); + From 89b8f7783da5be3c75d1594a399403e37cfa50e9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 08:57:29 +0800 Subject: [PATCH 133/913] =?UTF-8?q?=E6=B7=BB=E5=8A=A0forked=5Fform?= =?UTF-8?q?=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 2 +- ..._add_forked_from_project_id_to_projects.rb | 5 ++ db/schema.rb | 63 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index e06542cba..324dc6202 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -15,7 +15,7 @@ 版本库地址:<%= @repos_url %> <% else %> 版本库地址:<%= h @repository.url %> - <% end %> + <% end %>-
        diff --git a/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb b/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb new file mode 100644 index 000000000..f679eaecd --- /dev/null +++ b/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb @@ -0,0 +1,5 @@ +class AddForkedFromProjectIdToProjects < ActiveRecord::Migration + def change + add_column :projects, :forked_from_project_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index c6ca6a0ce..886f233a8 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 => 20151130033906) do +ActiveRecord::Schema.define(:version => 20151203072815) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -891,16 +894,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) 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" @@ -970,6 +963,7 @@ ActiveRecord::Schema.define(:version => 20151130033906) do t.integer "course_group_id", :default => 0 end + add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" @@ -1303,27 +1297,28 @@ ActiveRecord::Schema.define(:version => 20151130033906) do end create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false t.integer "parent_id" t.datetime "created_on" t.datetime "updated_on" t.string "identifier" - t.integer "status", :default => 1, :null => false + t.integer "status", :default => 1, :null => false t.integer "lft" t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false + t.boolean "inherit_members", :default => false, :null => false t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 t.integer "user_id" - t.integer "dts_test", :default => 0 + t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" t.integer "gpid" + t.integer "forked_from_project_id" end add_index "projects", ["lft"], :name => "index_projects_on_lft" From 6553559929f76759cc83849f7bfe772154488058 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 10:56:16 +0800 Subject: [PATCH 134/913] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 ++ app/controllers/users_controller.rb | 4 +- app/models/exercise.rb | 14 ++++ app/views/users/_user_message_course.html.erb | 70 +++++++++++++++++++ .../exercise_close_to_deadline_warn.rake | 22 ++++++ lib/tasks/exercise_publishtime.rake | 22 ++++++ 6 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/exercise_close_to_deadline_warn.rake create mode 100644 lib/tasks/exercise_publishtime.rake diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6d6d429b6..db09c50a5 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -316,6 +316,9 @@ class ExerciseController < ApplicationController @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save + @exercise.course.members.each do |m| + @exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2) + end #redirect_to exercise_index_url(:course_id=> @course.id) respond_to do |format| format.js @@ -331,6 +334,7 @@ class ExerciseController < ApplicationController @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end + @exercise.course_messages.destroy_all @exercise.exercise_users.destroy_all @exercise.exercise_status = 1 @exercise.publish_time = nil diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 626bb59fc..834009d71 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -92,7 +92,7 @@ class UsersController < ApplicationController end # 用户消息 - # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复 + # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验 # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) def user_messages if !User.current.logged? @@ -128,7 +128,7 @@ class UsersController < ApplicationController #课程相关消息 when 'homework' - @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork') and user_id =?", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc") when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") when 'course_news' diff --git a/app/models/exercise.rb b/app/models/exercise.rb index d23e8f115..c91e59fd9 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -6,4 +6,18 @@ class Exercise < ActiveRecord::Base has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number" has_many :exercise_users, :dependent => :destroy has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过 + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + after_create :acts_as_course_message + def acts_as_course_message + if self.course + if self.exercise_status == 2 #未发布 + #self.course.members.each do |m| + self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2) + #end + # else + # self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的 + end + end + end end diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 9f2c9b9ef..566677964 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -612,4 +612,74 @@
      • <%= time_tag(ma.created_at).html_safe %>
      • <% end %> + + + <% if ma.course_message_type == "Exercise" && ma.status == 2 %> +
          +
        • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
        • +
        • + <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", + user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布了课程测验 :
        • +
        • + <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))"%> +
        • + + +
        • <%= time_tag(ma.created_at).html_safe %>
        • +
        + <% end %> + + + <% if ma.course_message_type == "Exercise" && ma.status == 3 %> +
          +
        • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
        • +
        • + <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", + user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的测验:
        • +
        • + <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))"%> + +
        • + + +
        • 截止时间快到啦
        • +
        • <%= time_tag(ma.created_at).html_safe %>
        • +
        + <% end %> <% end %> \ No newline at end of file diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake new file mode 100644 index 000000000..2af513ee8 --- /dev/null +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + +namespace :exercise_deadline_warn do + desc "exercise deadline warn" + task :deadline_warn => :environment do + exercises = Exercise.where("date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 + exercises.each do |exercise| + if exercise.exercise_status == 2 #发布的作业才能告给学生发截止消息 + course = exercise.course + course.members.each do |m| + #CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了 + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) unless m.user.allowed_to?(:as_teacher,m) + end + # if homework.course_acts.size == 0 + # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) + # end + # 邮件通知 + #Mailer.run.homework_added(homework) + end + end + end +end \ No newline at end of file diff --git a/lib/tasks/exercise_publishtime.rake b/lib/tasks/exercise_publishtime.rake new file mode 100644 index 000000000..6cef511e2 --- /dev/null +++ b/lib/tasks/exercise_publishtime.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + +namespace :exercise_publishtime do + desc "start publish exercise" + task :publish => :environment do + exercises = Exercise.where("date_format(publish_time,'%Y-%m-%d')= '#{Date.today}'") + exercises.each do |exercise| + if exercise.exercise_status == 1 #未发布 + exercise.update_column('exercise_status', 2) #改为发布 + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + # if homework.course_acts.size == 0 + # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) + # end + # 邮件通知 + #Mailer.run.homework_added(homework) + end + end + end +end \ No newline at end of file From 2855c0e409e104d66ef612fb88056e117442e5c7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 10:59:09 +0800 Subject: [PATCH 135/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=B8=8E=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=8A=A8=E6=80=81=E5=8F=8A=E4=B8=AA=E4=BA=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=B8=80=E8=87=B4=EF=BC=8C?= =?UTF-8?q?=E5=8C=85=E6=8B=AC=E6=9C=89=E5=9B=9E=E5=A4=8D=E6=A1=86=E3=80=81?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=8F=9C=E5=8D=95=E3=80=81=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E3=80=81=E9=97=B4=E8=B7=9D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 5 + app/controllers/projects_controller.rb | 13 +- app/models/forge_activity.rb | 6 +- app/views/comments/create.js.erb | 5 +- app/views/layouts/base_projects.html.erb | 2 +- app/views/projects/_attachment_acts.html.erb | 35 +++++ .../projects/_project_activities.html.erb | 102 ++++++++++++ app/views/projects/_project_create.html.erb | 38 +++++ app/views/projects/_project_news.html.erb | 106 +++++++++++++ app/views/projects/show.html.erb | 145 ++++-------------- app/views/projects/show.js.erb | 1 + 11 files changed, 340 insertions(+), 118 deletions(-) create mode 100644 app/views/projects/_attachment_acts.html.erb create mode 100644 app/views/projects/_project_activities.html.erb create mode 100644 app/views/projects/_project_create.html.erb create mode 100644 app/views/projects/_project_news.html.erb create mode 100644 app/views/projects/show.js.erb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9b090de9a..6f173b7c2 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -169,6 +169,11 @@ class MessagesController < ApplicationController course_activity.updated_at = Time.now course_activity.save end + forge_activity = ForgeActivity.where("forge_act_type='Message' and forge_act_id=#{@topic.id}").first + if forge_activity + forge_activity.updated_at = Time.now + forge_activity.save + end user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first if user_activity user_activity.updated_at = Time.now diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 715f56d3d..200bd4d69 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -320,9 +320,20 @@ class ProjectsController < ApplicationController @activity.scope_select {|t| !has["show_#{t}"].nil?} =end + @page = params[:page] ? params[:page].to_i + 1 : 0 # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20); + case params[:type] + when nil + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo')",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'issue' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'news' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'message' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10) + end + #events = @activity.events(@date_from, @date_to) else @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index bb5f30442..115575289 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -48,8 +48,10 @@ class ForgeActivity < ActiveRecord::Base def add_org_activity if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first - org_activity.created_at = self.created_at - org_activity.save + if org_activity + org_activity.created_at = self.created_at + org_activity.save + end else OrgActivity.create(:user_id => self.user_id, :org_act_id => self.forge_act_id, diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index ea904a63f..b0354b53f 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,3 +1,6 @@ +<% if @course %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); - +<% else %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); +<% end %> init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%"); diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 9e9bd688f..1d68c9fa0 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,7 +12,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %> <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb new file mode 100644 index 000000000..2baa8791a --- /dev/null +++ b/app/views/projects/_attachment_acts.html.erb @@ -0,0 +1,35 @@ +
        +
        +
        + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
        +
        +
        + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目附件", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
        + +
        +
        + 发布时间:<%= format_time(activity.created_on) %> +
        +

        <%= textAreailizable act, :description %>

        +
        +
        + <%#= activity.description.html_safe %> +
        +
        +
        + +
        +
        +
        + +
        \ No newline at end of file diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb new file mode 100644 index 000000000..f97646d3c --- /dev/null +++ b/app/views/projects/_project_activities.html.erb @@ -0,0 +1,102 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + +<% unless forge_acts.empty? %> + <% forge_acts.each do |activity| -%> + + + <% case activity.forge_act_type %> + <% when "ProjectCreateInfo" %> + <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> + + <% when "Issue" %> + <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id} %> + + + <% when "Message" %> + <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %> + + <% when "News" %> + <% if !activity.forge_act.nil? and activity.forge_act.project %> + <%= render :partial => 'projects/project_news', :locals => {:activity=>activity.forge_act, :user_activity_id=>activity.id} %> + <% end %> + + <% when "Attachment" %> + <%= render :partial => 'projects/attachment_acts', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> + + + + + + + + + <%#= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %> + + + + + + + + + <% end %> + <% end %> +<% end %> + +<% if forge_acts.count == 10 %> +
        展开更多<%= link_to "", project_path(@project.id, :type => type, :page => page), :id => "more_forge_activities_link", :remote => "true", :class => "none" %>
        +<% end %> + + \ No newline at end of file diff --git a/app/views/projects/_project_create.html.erb b/app/views/projects/_project_create.html.erb new file mode 100644 index 000000000..d966d8e18 --- /dev/null +++ b/app/views/projects/_project_create.html.erb @@ -0,0 +1,38 @@ +<% project = Project.find(activity.project_id) %> +<% user = User.find(project.user_id)%> +
        +
        +
        + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> +
        +
        +
        + <% if user.try(:realname) == ' ' %> + <%= link_to user, user_path(user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> +
        +
        + <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> +
        +
        + 创建时间:<%= format_time(project.created_on) %> +
        + +
        +
        +
        +
        \ No newline at end of file diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb new file mode 100644 index 000000000..919abc11e --- /dev/null +++ b/app/views/projects/_project_news.html.erb @@ -0,0 +1,106 @@ +
        +
        +
        + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
        +
        +
        + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
        + + <% if activity.sticky == 1%> + 置顶 + <% end%> +
        +
        + 发布时间:<%= format_time(activity.created_on) %> +
        +
        +
        + <%= activity.description.html_safe %> +
        +
        +
        + + +
        +
        +
        +
        + <% count=activity.comments.count %> +
        +
        +
        +
        + 回复(<%= count %>) +
        +
        <%#= format_date(activity.updated_on) %>
        + <%if count>3 %> + + <% end %> +
        + + <% replies_all_i = 0 %> + <% if count > 0 %> +
        +
          + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
        • +
          + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
          +
          +
          + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> +
          +
          + <%= comment.comments.html_safe %>
          +
          +
          +
        • + <% end %> +
        +
        + <% end %> + +
        +
        <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
        +
        +
        + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
        + +
        +

        + <% end%> +
        +
        +
        +
        +
        +
        +
        \ No newline at end of file diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index a3a2845f8..a58aeb281 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,114 +1,33 @@ -<%= javascript_include_tag "jquery.infinitescroll.js" %> -
        -

        <%= l(:label_activity) %>

        -
        - -<% unless @events_pages.empty? %> - <% @events_pages.each do |e| -%> - - <% if e.forge_act_type == "ProjectCreateInfo"%> -
        - <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
        - <%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %> <%= l(:label_project_create) %> : - <%= link_to e.project.name,{} ,:class => "problem_tit fl fb" %>
        -


        <%= l :label_create_time %> :<%= format_time(e.project.created_on) %>

        -
        -
        -
        - <% end %> - <% next if e.forge_act_type.safe_constantize.nil? - act = e.forge_act; - next if act.nil? %> - - <% if e.forge_act_type == "Issue" %> - - - <% elsif e.forge_act_type == "Journal" %> - - - <% elsif e.forge_act_type == "Message" %> -
        - <%= 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) %> : +<%#= stylesheet_link_tag 'courses' %> + + +
        +
        +
        项目动态
        +
          +
        • +
            +
          • +
              +
            • <%= link_to "全部动态", {:controller => "projects", :action => "show", :type => nil}, :class => "homepagePostTypeAll postTypeGrey" %>
            • +
            • <%= link_to "问题动态", {:controller => "projects", :action => "show", :type => "issue"}, :class => "homepagePostTypeMessage postTypeGrey" %>
            • + +
            • <%= link_to "新闻动态", {:controller => "projects", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
            • + +
            • <%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %>
            • + +
            +
          • +
          +
        • +
        + - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - project_boards_path(@project,:topic_id => act.id), - :class => "problem_tit fl fb " %> -
        -

        <%= textAreailizable act,:content %>
        -

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

        -
        -
        -
        - - <% elsif e.forge_act_type == "News" %> - - - - <% elsif e.forge_act_type == "Attachment" %> -
        - <%= 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_attachment)}: #{act.filename}"), {:controller => 'attachments', :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) %>

        -
        -
        -
        - <% end %> - <% end %> -<% end %> -<%= paginate @events_pages, :left => 3, :right => 3 %> +
        + <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %> +
        \ No newline at end of file diff --git a/app/views/projects/show.js.erb b/app/views/projects/show.js.erb new file mode 100644 index 000000000..384c111d1 --- /dev/null +++ b/app/views/projects/show.js.erb @@ -0,0 +1 @@ +$("#show_more_forge_activities").replaceWith("<%= escape_javascript( render :partial => 'projects/project_activities',:locals => {:forge_acts => @events_pages, :page => @page,:type => @type} )%>"); From 03588ca88ded7a776c16339d4bc6a65ad542ac35 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 11:21:41 +0800 Subject: [PATCH 136/913] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=8F=91=E5=B8=83=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_publish.rake | 4 ++++ lib/tasks/exercise_publishtime.rake | 22 ---------------------- 2 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 lib/tasks/exercise_publishtime.rake diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index aacd67c1f..a27c6a6fb 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -6,6 +6,10 @@ namespace :exercise_publish do exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end diff --git a/lib/tasks/exercise_publishtime.rake b/lib/tasks/exercise_publishtime.rake deleted file mode 100644 index 6cef511e2..000000000 --- a/lib/tasks/exercise_publishtime.rake +++ /dev/null @@ -1,22 +0,0 @@ -#coding=utf-8 - -namespace :exercise_publishtime do - desc "start publish exercise" - task :publish => :environment do - exercises = Exercise.where("date_format(publish_time,'%Y-%m-%d')= '#{Date.today}'") - exercises.each do |exercise| - if exercise.exercise_status == 1 #未发布 - exercise.update_column('exercise_status', 2) #改为发布 - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - # if homework.course_acts.size == 0 - # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) - # end - # 邮件通知 - #Mailer.run.homework_added(homework) - end - end - end -end \ No newline at end of file From 06122dab1dfad02ea5d9c36a2c36b08655153b72 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 11:24:24 +0800 Subject: [PATCH 137/913] =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E7=9A=84=E6=B5=8B=E9=AA=8C=E9=9C=80=E8=A6=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_close_to_deadline_warn.rake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 2af513ee8..890191167 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -3,9 +3,8 @@ namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do - exercises = Exercise.where("date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 + exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 exercises.each do |exercise| - if exercise.exercise_status == 2 #发布的作业才能告给学生发截止消息 course = exercise.course course.members.each do |m| #CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了 @@ -16,7 +15,6 @@ namespace :exercise_deadline_warn do # end # 邮件通知 #Mailer.run.homework_added(homework) - end end end end \ No newline at end of file From e2f5dcc3f977536513ea8e8becf4d705a5226472 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 13:39:17 +0800 Subject: [PATCH 138/913] =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E7=9A=84=E6=B5=8B=E9=AA=8C=E9=9C=80=E8=A6=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_close_to_deadline_warn.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 890191167..2deb7204e 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -3,6 +3,7 @@ namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do + #exercise_status 1 未发布 2 已发布 3已截止 exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 exercises.each do |exercise| course = exercise.course From dbfc4969e071b8dea30c9861414aea22d643ea92 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 15:36:19 +0800 Subject: [PATCH 139/913] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E6=B6=88=E6=81=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 12 ++++++++++++ app/views/users/_user_message_course.html.erb | 6 +++--- lib/tasks/exercise_close_to_deadline_warn.rake | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 55daf0562..a99ab32ec 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -9,6 +9,10 @@ class ExerciseController < ApplicationController publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) publish_exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) end_exercises.each do |exercise| @@ -35,6 +39,10 @@ class ExerciseController < ApplicationController publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) publish_exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) end_exercises.each do |exercise| @@ -504,6 +512,10 @@ class ExerciseController < ApplicationController @exercise.update_attributes(:show_result => params[:show_result]) @exercise.update_attributes(:exercise_status => 2) @exercise.update_attributes(:publish_time => Time.now) + course = @exercise.course + course.members.each do |m| + @exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end redirect_to exercise_url(@exercise) return elsif @exercise.publish_time > Time.now diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 566677964..640f98b1f 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -640,9 +640,9 @@
      • 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
      • -
      • 答题时间:<%= ma.course_message.time == 0 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
      • +
      • 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
      • <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%> -

        请记得在截止时间前完成测验噢,辛苦啦!

        +

        请记得在截止时间前完成测验噢,辛苦啦!

        <% end %>
        @@ -674,7 +674,7 @@
      • 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
      • 测验标题:<%= ma.course_message.exercise_name %>
      • 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
      • -
      • 答题时间:<%= ma.course_message.time == 0 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
      • +
      • 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
      • 请及时完成课程测验,辛苦啦!

        diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 2deb7204e..e2808818f 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -1,5 +1,5 @@ #coding=utf-8 - +#需要在0点以后执行 namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do From c1747ab2172f695174736d68546129ccbb33e3c3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 15:49:05 +0800 Subject: [PATCH 140/913] =?UTF-8?q?fork=E9=87=8D=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 63 ++++++++++++------- app/views/repositories/show.html.erb | 6 +- ...1204062220_add_forked_count_to_projects.rb | 5 ++ db/schema.rb | 14 +---- lib/gitlab-cli/lib/gitlab/client/projects.rb | 5 +- 5 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20151204062220_add_forked_count_to_projects.rb diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 2bd54954a..c1e124063 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -64,32 +64,53 @@ class RepositoriesController < ApplicationController end def forked - # 被forked的标识如果不满足单个用户唯一性,则不执行fork - if is_sigle_identifier?(User.current, @repository.identifier) - # REDO: 那些人有权限forked项目 - g = Gitlab.client - gproject = g.post ("/projects/fork/#{@project.gpid}?user_id=#{User.current.gid}") - if gproject - copy_project(@project, gproject) - end + # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项 + unless has_forked?(@project, User.current) + project = project_from_current_project(@project.id, User.current.id) + redirect_to project_path(project) else - flash[:notice] = l(:project_gitlab_fork_double_message) - redirect_to settings_project_url(@project, :tab => 'repositories') + # 单个用户只能拥有一个名字一样的版本库,否则不能fork + # if is_sigle_identifier?(User.current, @repository.identifier) + # REDO: 那些人有权限forked项目 + g = Gitlab.client + gproject = g.fork(@project.gpid, User.current.gid) + if gproject + copy_project(@project, gproject) + forked_count = @project.forked_count.to_i + 1 + @project.update_attributes(:forked_count => forked_count) + end + # else + # flash[:notice] = l(:project_gitlab_fork_double_message) + # redirect_to settings_project_url(@project, :tab => 'repositories') + # end end + + end + + # 判断用户是否已经fork过该项目 + def has_forked?(project, user) + projects = Project.where("user_id =?", user) + projects.map(&:forked_from_project_id).detect{|s| s == @project.id}.nil? ? true : false + end + + # 获取当前用户fork过的项目 + def project_from_current_project(project, user) + project = Project.where("user_id =? and forked_from_project_id =?",user, project).first end # copy a project for fork - def copy_project(project, gproject) + def copy_project(tproject, gproject) project = Project.new - project.name = @project.name - project.is_public = @project.is_public - project.status = @project.status - project.description = @project.description - project.hidden_repo = @project.hidden_repo + project.name = tproject.name + project.is_public = tproject.is_public + project.status = tproject.status + project.description = tproject.description + project.hidden_repo = tproject.hidden_repo project.user_id = User.current.id project.project_type = 0 - project.project_new_type = @project.project_new_type + project.project_new_type = tproject.project_new_type project.gpid = gproject.id + project.forked_from_project_id = tproject.id if project.save r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => User.current, :roles => [r]) @@ -124,16 +145,16 @@ class RepositoriesController < ApplicationController def copy_repository(project, gproject) # 避免 - if is_sigle_identifier?(project.user_id, gproject.name) + # if is_sigle_identifier?(project.user_id, gproject.name) repository = Repository.factory('Git') repository.project_id = project.id repository.type = 'Repository::Gitlab' repository.url = gproject.name repository.identifier = gproject.name repository = repository.save - else - flash[:notice] = l(:project_gitlab_create_double_message) - end + # else + # flash[:notice] = l(:project_gitlab_create_double_message) + # end end def newrepo diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 324dc6202..d8b7c4625 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,8 +25,10 @@ -
        Fork 0
        - + + +
        <%= link_to "Fork", :controller => 'repositories', :action => 'forked'%> + <%= @project.forked_count.to_i %>
        <% if @changesets && !@changesets.empty? %> diff --git a/db/migrate/20151204062220_add_forked_count_to_projects.rb b/db/migrate/20151204062220_add_forked_count_to_projects.rb new file mode 100644 index 000000000..79fdc2573 --- /dev/null +++ b/db/migrate/20151204062220_add_forked_count_to_projects.rb @@ -0,0 +1,5 @@ +class AddForkedCountToProjects < ActiveRecord::Migration + def change + add_column :projects, :forked_count, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 6ad6c585f..a1e14c3bd 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 => 20151203072815) do +ActiveRecord::Schema.define(:version => 20151204062220) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -738,17 +738,6 @@ ActiveRecord::Schema.define(:version => 20151203072815) do add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - create_table "homework_detail_manuals", :force => true do |t| t.float "ta_proportion" t.integer "comment_status" @@ -1330,6 +1319,7 @@ ActiveRecord::Schema.define(:version => 20151203072815) do t.integer "project_new_type" t.integer "gpid" t.integer "forked_from_project_id" + t.integer "forked_count" end add_index "projects", ["lft"], :name => "index_projects_on_lft" diff --git a/lib/gitlab-cli/lib/gitlab/client/projects.rb b/lib/gitlab-cli/lib/gitlab/client/projects.rb index 3fab4347f..8d91edd06 100644 --- a/lib/gitlab-cli/lib/gitlab/client/projects.rb +++ b/lib/gitlab-cli/lib/gitlab/client/projects.rb @@ -241,8 +241,9 @@ class Gitlab::Client # Forks a project into the user namespace of the authenticated user. # @param [Integer] - The ID of the project to be forked - def fork(id) - post("/projects/fork/#{id}") + def fork(gpid, gid) + post ("/projects/fork/#{gpid}?user_id=#{gid}") + # post("/projects/fork/#{id}") end # Mark this project as forked from the other From 4a41039fa62546d4b7953507cc3378ef493250a0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 15:58:56 +0800 Subject: [PATCH 141/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=E6=94=B9=E6=88=90=E8=AF=BE=E7=A8=8B=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 981d44ce7..c37af0dc1 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -208,7 +208,7 @@
        <% unless contributor_course_scor(@course.id).count == 0 %>
          -

          课程贡献榜

          +

          课程活跃度

          <% contributor_course_scor(@course.id).each do |contributor_score| %> <% unless contributor_score.total_score ==0 %>
        • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %> From dfa9b4cf743f5f5165f3d5105683e97a5f0ce718 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 4 Dec 2015 16:13:55 +0800 Subject: [PATCH 142/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index ce336373b..e906bf778 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,9 +1,10 @@ -
          -

          <%= @subPage_title%>

          -
          -<% if @subPage_title == l(:label_student_list)%> - <%= render :partial => 'course_student', :locals => {:members => @members} %> -<% else%> - <%= render :partial => 'course_teacher', :locals => {:members => @members} %> -<% end%> - +
          +

          <%= @subPage_title%>

          + 修改角色 +
          +<% if @subPage_title == l(:label_student_list)%> + <%= render :partial => 'course_student', :locals => {:members => @members} %> +<% else%> + <%= render :partial => 'course_teacher', :locals => {:members => @members} %> +<% end%> + From 8fe53468e1e1ba3988370ae99d486951104dcc65 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Dec 2015 16:21:11 +0800 Subject: [PATCH 143/913] =?UTF-8?q?=E4=BD=9C=E5=93=81=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 14 ++- app/helpers/student_work_helper.rb | 11 ++ app/models/student_work.rb | 1 + app/views/attachments/destroy.js.erb | 9 ++ .../_programing_work_show.html.erb | 29 ++++- .../student_work/_revise_attachment.html.erb | 28 +++++ .../student_work/_revise_attachments.html.erb | 30 ----- app/views/student_work/_show.html.erb | 57 +++++---- .../student_work/_upload_attachment.html.erb | 50 ++++++++ .../student_work/revise_attachment.js.erb | 2 + config/routes.rb | 1 + public/javascripts/attachments.js | 118 ++++++++++++++++++ public/stylesheets/courses.css | 18 +++ public/stylesheets/public.css | 2 +- public/stylesheets/public_new.css | 2 +- 15 files changed, 311 insertions(+), 61 deletions(-) create mode 100644 app/views/student_work/_revise_attachment.html.erb delete mode 100644 app/views/student_work/_revise_attachments.html.erb create mode 100644 app/views/student_work/_upload_attachment.html.erb create mode 100644 app/views/student_work/revise_attachment.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd2a5b5fc..5e71b0114 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -4,7 +4,7 @@ class StudentWorkController < ApplicationController require 'bigdecimal' require "base64" before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work] - before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work] + before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment] @@ -527,6 +527,18 @@ class StudentWorkController < ApplicationController @course_activity = params[:course_activity].to_i end + def revise_attachment + Attachment.attach_filesex(@work, params[:attachments], params[:attachment_type]) + revise_attachments = @work.attachments.where("attachtype = 7").reorder("created_on desc") + if revise_attachments.count == 2 + revise_attachments.last.destroy + end + #@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first + respond_to do |format| + format.js + end + end + private def hsd_committed_work?(user, homework) sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index e1cf3464e..df5c872f8 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -126,4 +126,15 @@ module StudentWorkHelper end type end + + def revise_attachment_status homework, attach + date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d") + status = "" + if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date)) + status = "此时其他同学作品已公开" + else + status = "此时其他同学作品尚未公开" + end + return status + end end \ No newline at end of file diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 010ede635..884f4a089 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -10,6 +10,7 @@ class StudentWork < ActiveRecord::Base has_many :student_work_tests, order: 'id desc' # course's message has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + has_many :attachments, :dependent => :destroy before_destroy :delete_praise before_save :set_program_score, :set_src diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index d23422e24..cfbe68085 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,5 +1,9 @@ <% if @is_destroy%> $("#attachment_<%= @attachment.id%>").remove(); + if(document.getElementById("uploadReviseBox")) { + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + } <%else%> var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start @@ -26,5 +30,10 @@ $('#upload_file_count'+containerid).html(""+count+""+"个文件"+"已上传"); } } + + if(document.getElementById("uploadReviseBox")) { + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + } //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end <% end%> \ No newline at end of file diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index fd541c643..fc246ab8b 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -89,6 +89,11 @@
        +
        + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
        +
        +
        <%student_work_scores.each do |student_score|%>
        @@ -99,4 +104,26 @@ 收起
        -
        \ No newline at end of file +
        + diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb new file mode 100644 index 000000000..968a4853b --- /dev/null +++ b/app/views/student_work/_revise_attachment.html.erb @@ -0,0 +1,28 @@ +<% revise_attachment = work.attachments.where("attachtype = 7").first %> +<% if @homework.end_time < Date.today %> + <% if revise_attachment && @is_teacher %> +
        + 追加修订附件 +
        +
        + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>) +
        + <% end %> + <% if work.user == User.current %> +
        + 追加修订附件 +
        + <% if revise_attachment %> +
        + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %> +
        + <% end %> + + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/student_work/_revise_attachments.html.erb b/app/views/student_work/_revise_attachments.html.erb deleted file mode 100644 index 1321da368..000000000 --- a/app/views/student_work/_revise_attachments.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
        -
        - - 上传附件 - <%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %> - <%= file_field_tag 'attachments[dummy][file]', - :id => "_file#{work.id}", - :class => 'file_selector', - :multiple => true, - :onchange => "addReviseFiles(this, '#{work.id}');", - :style => 'display:none', - :data => { - :max_file_size => Setting.attachment_max_size.to_i.kilobytes, - :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), - :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js'), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :lebel_file_uploding => l(:lebel_file_uploding), - :delete_all_files => l(:text_are_you_sure_all), - :containerid => "#{work.id}" - } %> - - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> -
        - diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 894f9fb39..993b0f2aa 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -41,17 +41,18 @@
      • 附件: - <% if work.attachments.empty?%> + <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> + <% if com_attachments.empty?%> 尚未提交附件 <% else%>
        - <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments, :status => @homework.homework_detail_manual.comment_status} %> + <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
        <% end%>
      • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%>
        <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> @@ -61,30 +62,10 @@
      • - - <%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> - <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - - <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%#= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - +
        <%student_work_scores.each do |student_score|%> @@ -96,4 +77,26 @@ 收起
        -
        \ No newline at end of file +
        + \ No newline at end of file diff --git a/app/views/student_work/_upload_attachment.html.erb b/app/views/student_work/_upload_attachment.html.erb new file mode 100644 index 000000000..d9c69fc17 --- /dev/null +++ b/app/views/student_work/_upload_attachment.html.erb @@ -0,0 +1,50 @@ + +上传附件 + +
        + <%= form_tag(revise_attachment_student_work_path(work.id), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> +
        + + +
        +
        + + + 选择文件 + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => 'addReviseInputFiles(this,"'+'upload_files_submit_btn'+'");', + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> +
        + + +
        +
        +
        最多只能上传一个小于50MB的附件
        +
        +
        +
        +
        + <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> +
        +
        + 取消 +
        +
        + <% end %> +
        +
        diff --git a/app/views/student_work/revise_attachment.js.erb b/app/views/student_work/revise_attachment.js.erb new file mode 100644 index 000000000..74813d27b --- /dev/null +++ b/app/views/student_work/revise_attachment.js.erb @@ -0,0 +1,2 @@ +closeModal(); +$("#revise_attachment").html('<%= escape_javascript( render :partial => 'revise_attachment' ,:locals=>{ :work => @work})%>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f6fe95a33..59eb29d70 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,6 +206,7 @@ RedmineApp::Application.routes.draw do resources :student_work do member do post 'add_score' + post 'revise_attachment' get 'retry_work' get 'praise_student_work' get 'forbidden_anonymous_comment' diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index d7b49c8be..b60b6ad28 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -154,6 +154,73 @@ function addFile(inputEl, file, eagerUpload,btnId) { } addFile.nextAttachmentId = 1; +function addReviseFile(inputEl, file, eagerUpload,btnId) { + + var attachments_frame = '#attachments_fields'; + if ($(attachments_frame).children().length < 30) { + deleteallfiles = $(inputEl).data('deleteAllFiles'); + var attachmentId = addFile.nextAttachmentId++; + + var fileSpan = $('', { + 'id': 'attachments_' + attachmentId, + 'class': 'attachment' + }); + + fileSpan.append( + $('', { + 'type': 'text', + 'class': 'upload_filename readonly', + 'name': 'attachments[' + attachmentId + '][filename]', + 'readonly': 'readonly' + }).val(file.name), +// $('', { +// 'type': 'text', +// 'class': 'description', +// 'name': 'attachments[' + attachmentId + '][description]', +// 'maxlength': 254, +// 'placeholder': $(inputEl).data('descriptionPlaceholder') +// }).toggle(!eagerUpload), +// $('' + $(inputEl).data('fieldIsPublic') + ':').attr({ +// 'class': 'ispublic-label' +// }), +// $('', { +// 'type': 'checkbox', +// 'class': 'is_public_checkbox', +// 'value': 1, +// 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', +// checked: 'checked' +// }).toggle(!eagerUpload), + $(' ').attr({ + 'href': "#", + 'class': 'remove-upload' + }).click(function() { + if (confirm($(inputEl).data('areYouSure'))) { + removeReviseFile(); + if (!eagerUpload) { + (function(e) { + reload(e); + })(fileSpan); + } + } + + }).toggle(!eagerUpload), + $('
        ', { + 'class': 'div_attachments', + 'name': 'div_' + 'attachments_' + attachmentId + }) + ).appendTo('#attachments_fields'); + + $("#uploadReviseBox").addClass('disable_link'); + $("#choose_revise_attach").attr("onclick","return false;"); + + if (eagerUpload) { + ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId); + } + return attachmentId; + } + return null; +} + function ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId) { //上传开始调用函数 function onLoadstart(e) { @@ -293,6 +360,13 @@ function removeFile() { return false; } +function removeReviseFile() { + $(this).parent('span').remove(); + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + return false; +} + //gcm delete all file //modify by yutao 2015-5-14 ��1��ҳ����ڶ���ϴ��ؼ�ʱ�˿�������bug �ʸ�֮ start function removeAll(containerid) { @@ -346,6 +420,30 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) { }); } +function addReviseInputFiles(inputEl,btnId) { + // var clearedFileInput = $(inputEl).clone().val(''); + if (inputEl.files) { + uploadAndAttachReviseFiles(inputEl.files, inputEl,btnId); + // $(inputEl).remove(); + } else { + // browser not supporting the file API, upload on form submission + var attachmentId; + var aFilename = inputEl.value.split(/\/|\\/); + var count = $('#attachments_fields>span').length; + attachmentId = addReviseFile(inputEl, { + name: aFilename[aFilename.length - 1] + }, false); + if (attachmentId) { + $(inputEl).attr({ + name: 'attachments[' + attachmentId + '][file]' + }).hide(); + if (count <= 0) count = 1; + } + } + + //clearedFileInput.insertAfter('#attachments_fields'); +} + function addInputFiles(inputEl,btnId) { // var clearedFileInput = $(inputEl).clone().val(''); if (inputEl.files) { @@ -405,6 +503,26 @@ function addInputFiles_board(inputEl, id,btnId) { //clearedFileInput.insertAfter('#attachments_fields'); } +function uploadAndAttachReviseFiles(files, inputEl,btnId) { + + var maxFileSize = $(inputEl).data('max-file-size'); + var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); + + var sizeExceeded = false; + $.each(files, function() { + if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) { + sizeExceeded = true; + } + }); + if (sizeExceeded) { + window.alert(maxFileSizeExceeded); + } else { + $.each(files, function() { + addReviseFile(inputEl, this, true,btnId); + }); + } +} + function uploadAndAttachFiles(files, inputEl,btnId) { var maxFileSize = $(inputEl).data('max-file-size'); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 584a49a4f..c2132c3fa 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1197,3 +1197,21 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no- .resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;} a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.blueCir{ background:#3598db; color:#fff;} + +/*上传资源弹窗*/ +.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} +.uploadDialogText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:140px; display:inline-block; font-weight: bold;} +.uploadBoxContainer {height:33px; line-height:33px; margin-top:10px; position:relative} +.uploadBox {width:100px; height:33px; line-height:33px; text-align:center; vertical-align:middle; background-color:#269ac9; border-radius:3px; float:left; margin-right:12px;} +a.uploadBoxIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:81px; height:30px; padding-left:22px; font-size:14px; color:#ffffff;} +a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; width:100px; height:33px;} +.chooseFile {color:#ffffff; display:block; margin-left:32px;} +.uploadResourceIntr {width:250px; height:33px; float:left; line-height:33px; font-size:12px;} +.uploadResourceName {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444; margin-bottom:2px;} +.uploadResourceIntr2 {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444;} +.uploadType {margin:10px 0; border:1px solid #e6e6e6; width:100px; height:30px; outline:none; font-size:12px; color:#888888;} +.uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;} +.mb10 {margin-bottom: 10px} +.mb15 {margin-bottom: 15px} +div.disable_link {background-color: #c1c1c1 !important;} +div.disable_link :hover {background-color: #c1c1c1} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index a1dfe3f4d..70aad2cbe 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -410,7 +410,7 @@ a:hover.search_btn{ background: #0fa9bb;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} -.resourceClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;} +.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index db2d021d9..c60adf460 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -566,7 +566,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} .sendText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:100px; display:inline-block;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} -.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;} +.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} From b6edabed9c059ccd07750876799310c6f378f319 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 16:21:48 +0800 Subject: [PATCH 144/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 + app/views/courses/settings.html.erb | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cd1de16fc..5da9db395 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -374,6 +374,7 @@ class CoursesController < ApplicationController def settings if User.current.allowed_to?(:as_teacher,@course) + @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @course.members.new diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 5c3918f00..8d3454776 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -1,6 +1,13 @@

        <%= l(:label_course_modify_settings)%>

        +
          @@ -118,4 +125,4 @@ } $("#time_selected").click(select); $("#term_selected").click(select); - + From 9716e99533600417b6b4f0b2b98ba9b2664e3560 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 16:33:56 +0800 Subject: [PATCH 145/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E2=80=9C=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/views/courses/member.html.erb | 6 +++++- app/views/courses/settings.html.erb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5da9db395..0c61c449e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -374,7 +374,7 @@ class CoursesController < ApplicationController def settings if User.current.allowed_to?(:as_teacher,@course) - + @select_tab = params[:tab] @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @course.members.new diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index e906bf778..3aa7d4b57 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,6 +1,10 @@

          <%= @subPage_title%>

          - 修改角色 + <% if User.current.allowed_to?(:as_teacher,@course) %> + + <%=link_to "修改角色", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %> + + <% end %>
          <% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 8d3454776..3456634d5 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -3,7 +3,7 @@
        \ No newline at end of file diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb index 79733db31..f485cb8cc 100644 --- a/app/views/student_work/update.js.erb +++ b/app/views/student_work/update.js.erb @@ -1,5 +1,5 @@ <% if @submit_result%> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + From 6fad26cabf1c16c7cd566b59d931dae4ca7158b9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 17:32:56 +0800 Subject: [PATCH 150/913] =?UTF-8?q?=E5=8E=BB=E6=AD=BB=E5=A5=A5placebold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index c41945885..ca62b9664 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -22,7 +22,7 @@ <% else %> <%= render :partial => 'navigation' %>
        克隆网址:
        - + From ab4d0e46785d92818b0f5771426d72f3f7787b4d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 17:34:48 +0800 Subject: [PATCH 151/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascripts/org_subfields.js.coffee | 3 + app/assets/stylesheets/org_subfields.css.scss | 3 + app/controllers/org_subfields_controller.rb | 19 ++++++ app/helpers/org_subfields_helper.rb | 2 + app/models/org_subfield.rb | 3 + app/models/organization.rb | 1 + app/views/layouts/base_org.html.erb | 55 +---------------- app/views/org_subfields/create.js.erb | 4 ++ app/views/org_subfields/destroy.js.erb | 4 ++ app/views/org_subfields/update.js.erb | 1 + .../_org_left_subfield_list.html.erb | 60 +++++++++++++++++++ .../organizations/_subfield_list.html.erb | 51 ++++++++++++++++ app/views/organizations/setting.html.erb | 27 ++++++++- config/routes.rb | 4 ++ .../20151204030143_create_org_subfields.rb | 13 ++++ public/stylesheets/org.css | 12 +++- .../org_subfields_controller_spec.rb | 5 ++ 17 files changed, 211 insertions(+), 56 deletions(-) create mode 100644 app/assets/javascripts/org_subfields.js.coffee create mode 100644 app/assets/stylesheets/org_subfields.css.scss create mode 100644 app/controllers/org_subfields_controller.rb create mode 100644 app/helpers/org_subfields_helper.rb create mode 100644 app/models/org_subfield.rb create mode 100644 app/views/org_subfields/create.js.erb create mode 100644 app/views/org_subfields/destroy.js.erb create mode 100644 app/views/org_subfields/update.js.erb create mode 100644 app/views/organizations/_org_left_subfield_list.html.erb create mode 100644 app/views/organizations/_subfield_list.html.erb create mode 100644 db/migrate/20151204030143_create_org_subfields.rb create mode 100644 spec/controllers/org_subfields_controller_spec.rb diff --git a/app/assets/javascripts/org_subfields.js.coffee b/app/assets/javascripts/org_subfields.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/org_subfields.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/org_subfields.css.scss b/app/assets/stylesheets/org_subfields.css.scss new file mode 100644 index 000000000..19263385e --- /dev/null +++ b/app/assets/stylesheets/org_subfields.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the org_subfields controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb new file mode 100644 index 000000000..da20b6fcf --- /dev/null +++ b/app/controllers/org_subfields_controller.rb @@ -0,0 +1,19 @@ +class OrgSubfieldsController < ApplicationController + def create + @subfield = OrgSubfield.create(:name => params[:name]) + @organization = Organization.find(params[:organization_id]) + @organization.org_subfields << @subfield + @subfield.update_attributes(:priority => @subfield.id) + end + + def destroy + @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) + @subfield.destroy + end + + def update + @subfield = OrgSubfield.find(params[:id]) + @subfield.update_attributes(:name => params[:name]) + end +end diff --git a/app/helpers/org_subfields_helper.rb b/app/helpers/org_subfields_helper.rb new file mode 100644 index 000000000..a9f8a396f --- /dev/null +++ b/app/helpers/org_subfields_helper.rb @@ -0,0 +1,2 @@ +module OrgSubfieldsHelper +end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb new file mode 100644 index 000000000..1660310f8 --- /dev/null +++ b/app/models/org_subfield.rb @@ -0,0 +1,3 @@ +class OrgSubfield < ActiveRecord::Base + belongs_to :organization, :foreign_key => :organization_id +end \ No newline at end of file diff --git a/app/models/organization.rb b/app/models/organization.rb index a35f68c26..350dc3080 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -6,6 +6,7 @@ class Organization < ActiveRecord::Base has_many :courses, :through => :org_courses has_many :org_document_comments, :dependent => :destroy has_many :org_courses, :dependent => :destroy + has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members validates_uniqueness_of :name after_create :save_as_org_activity diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index b071a7c3b..aa46c35ee 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -81,59 +81,8 @@ <%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
        -
        -
        - <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %> -
        -
        - 项目 - <%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - - - - - - - - - - - - - -
        -
        -
          - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%> - - - - -
        -
        -
        - 课程 - <%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> - - - - - - - - - - - - - -
        -
        -
          - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%> -
        -
        +
        + <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
        diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb new file mode 100644 index 000000000..8a676e93e --- /dev/null +++ b/app/views/org_subfields/create.js.erb @@ -0,0 +1,4 @@ +$("#org_subfield_list").html(""); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>"); +$("#sub_field_left_lists").html(""); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb new file mode 100644 index 000000000..8a676e93e --- /dev/null +++ b/app/views/org_subfields/destroy.js.erb @@ -0,0 +1,4 @@ +$("#org_subfield_list").html(""); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>"); +$("#sub_field_left_lists").html(""); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb new file mode 100644 index 000000000..2def5c5f8 --- /dev/null +++ b/app/views/org_subfields/update.js.erb @@ -0,0 +1 @@ +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb new file mode 100644 index 000000000..7c30aa600 --- /dev/null +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -0,0 +1,60 @@ +
        + <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> +
        +
        + 项目 + <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + + + + + + + + + + + + + +
        +
        +
          + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + + + + +
        +
        +
        + 课程 + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%> + + + + + + + + + + + + + +
        +
        +
          + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
        +
        +<% organization.org_subfields.each do |field| %> +
        + <%= field.name %> + <%=link_to "", :title => "关联#{field.name}"%> +
        +
        +
        +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb new file mode 100644 index 000000000..f148fc561 --- /dev/null +++ b/app/views/organizations/_subfield_list.html.erb @@ -0,0 +1,51 @@ + +
          +
        • 已有栏目
        • +
        • 状态
        • +
          +
        +
          +
        • 动态
        • +
        • 默认
        • +
          +
        +
          +
        • 项目
        • +
        • 默认
        • +
          +
        +
          +
        • 课程
        • +
        • 默认
        • +
          +
        + <% subfields.each do |field| %> +
          +
        • <%= field.name %>
        • +
        • 新增
        • + <%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %> + 编辑 +
          +
        + <% end %> + + \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 96fef706a..138a7993a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -2,7 +2,7 @@ function g(o){return document.getElementById(o);} function HoverLi(n){ //如果有N个标签,就将i<=N; - for(var i=1;i<=2;i++){ + for(var i=1;i<=3;i++){ g('orgSetting_'+i).className='orgSettingOp'; g('orgContent_'+i).className='undis';} g('orgContent_'+n).className='dis ml15 mr15'; @@ -34,6 +34,7 @@
        • 信息
        • 成员
        • +
        • 分栏
        @@ -104,4 +105,26 @@
        - \ No newline at end of file +
        +
        + <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %> +
        +
        +
        +

        新增栏目

        + <%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %> + +
        + 确定 + <% end %> +
        +
        +
        +
        + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index bb6d7b940..27e9d7861 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,10 @@ RedmineApp::Application.routes.draw do end end + resources :org_subfields do + + end + resources :org_document_comments do member do post 'add_reply' diff --git a/db/migrate/20151204030143_create_org_subfields.rb b/db/migrate/20151204030143_create_org_subfields.rb new file mode 100644 index 000000000..2727cdef0 --- /dev/null +++ b/db/migrate/20151204030143_create_org_subfields.rb @@ -0,0 +1,13 @@ +class CreateOrgSubfields < ActiveRecord::Migration + def up + create_table :org_subfields do |t| + t.integer :organization_id + t.integer :priority + t.string :name + t.timestamps + end + end + + def down + end +end diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index a0118b263..897eb8734 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -54,4 +54,14 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;} /*关联项目弹窗*/ .projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;} -.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} \ No newline at end of file +.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} + +/*组织首页新151204Tim*/ +.orgNav {width:1000px; height:30px; background-color:#cfcfcf; margin:0 auto;} +.orgContainer {width:100%; margin:0 auto; background-color:#cfcfcf;} +.navOrgLogo {width:21px; height:30px; margin-left:2px; margin-right:15px;} +.navOrgMenu {display:inline-block;height:30px; line-height:30px; vertical-align:middle;} +a.linkGrey8 {color:#888888;} +a.linkGrey8:hover {color:#585858;} +.orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;} +.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;} \ No newline at end of file diff --git a/spec/controllers/org_subfields_controller_spec.rb b/spec/controllers/org_subfields_controller_spec.rb new file mode 100644 index 000000000..4bc89dae0 --- /dev/null +++ b/spec/controllers/org_subfields_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgSubfieldsController, :type => :controller do + +end From 4cb58211ad9a79696c3648f21ef398494160e021 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 17:44:46 +0800 Subject: [PATCH 152/913] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_mail_anonymous_comment_open.html.erb | 2 +- config/locales/mailers/zh.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/send_mail_anonymous_comment_open.html.erb b/app/views/mailer/send_mail_anonymous_comment_open.html.erb index 5409ade55..3aa3d1c21 100644 --- a/app/views/mailer/send_mail_anonymous_comment_open.html.erb +++ b/app/views/mailer/send_mail_anonymous_comment_open.html.erb @@ -2,7 +2,7 @@
        • <%= l(:mail_issue_content)%> -

          <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经开启匿评了!

          +

          <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经开启匿评了,请您关注!

        diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 97f0029ea..7b56011b1 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -26,6 +26,6 @@ zh: mail_attention: "请您关注!" mail_homework_endtime: "作业截止时间快到了!" mail_homework: "作业:" - mail_anonymous_comment_close: "作业匿评已经关闭!" + mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!" mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" - mail_anonymous_comment_failed: "作业匿评开启失败!" \ No newline at end of file + mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" \ No newline at end of file From 5b0bdb5069f7f5c4faae4853187890ae1545da5c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 18:19:35 +0800 Subject: [PATCH 153/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E5=86=85=E5=AE=B9=E5=8F=8A=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_left_subfield_list.html.erb | 4 ++-- app/views/organizations/_subfield_list.html.erb | 11 ++++++++--- app/views/organizations/setting.html.erb | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 7c30aa600..52201fd52 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -45,7 +45,7 @@ -
        +
          <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
        @@ -55,6 +55,6 @@ <%= field.name %> <%=link_to "", :title => "关联#{field.name}"%>
        -
        + <% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index f148fc561..6ba60245a 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -34,7 +34,12 @@ function edit(show_id, edit_id){ $(show_id).toggle(); $(edit_id).toggle(); - $(edit_id).focus(); + $(edit_id).find('input').focus(); + $(edit_id).find('input').on('keypress',function(e){ + if(e.keyCode == 13){ + this.blur(); + } + }) } function update_subfield(show_id, edit_id, field_id, input_value) { if ($(show_id).html().trim() != input_value.trim()) { @@ -44,8 +49,8 @@ type :'put' }); } - $(show_id).show(); - $(edit_id).hide(); + $(show_id).show(); + $(edit_id).hide(); // $(edit_id).focus(); } \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 138a7993a..e0f262b99 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -34,7 +34,7 @@
        • 信息
        • 成员
        • -
        • 分栏
        • +
        • 栏目
        From 01b82e59d80d0ad3e5cf1381b68f8f2e5b682bef Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 5 Dec 2015 11:30:05 +0800 Subject: [PATCH 154/913] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 1 + app/controllers/organizations_controller.rb | 13 +- app/views/layouts/base_organization.html.erb | 113 ++++++++++++++++++ app/views/org_subfields/update.js.erb | 4 +- .../_org_left_subfield_list.html.erb | 34 +----- app/views/organizations/show.html.erb | 4 +- public/images/home_logo.png | Bin 0 -> 1213 bytes 7 files changed, 134 insertions(+), 35 deletions(-) create mode 100644 app/views/layouts/base_organization.html.erb create mode 100644 public/images/home_logo.png diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index da20b6fcf..6fdf0ae40 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -14,6 +14,7 @@ class OrgSubfieldsController < ApplicationController def update @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) @subfield.update_attributes(:name => params[:name]) end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85f57917b..47a0930a5 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -94,7 +94,11 @@ class OrganizationsController < ApplicationController end @page = params[:page] respond_to do |format| - format.html + format.html { + if !params[:show_homepage].nil? + render :layout => 'base_organization' + end + } format.js end else @@ -102,6 +106,13 @@ class OrganizationsController < ApplicationController end end + def homepage + @organization = Organization.find(params[:id]) + respond_to do |format| + format.html {render :layout => 'base_organization'} + end + end + def update @organization = Organization.find(params[:id]) @organization.name = params[:organization][:name] diff --git a/app/views/layouts/base_organization.html.erb b/app/views/layouts/base_organization.html.erb new file mode 100644 index 000000000..653708bab --- /dev/null +++ b/app/views/layouts/base_organization.html.erb @@ -0,0 +1,113 @@ + + +<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %> +<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%> + + + 课程主页 + + + + + + + + + +
        +
        + + + +
        +
        +
        +
        +
        +
        + + + +
        + <%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> + <% if @organization.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> +
        + + <% if User.current.admin_of_org?(@organization) and params[:show_homepage].nil? %> + 配置 + <% end %> + +
        +
        + <%= link_to '文章', organization_org_document_comments_path(@organization) %> ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) |  + <%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) +
        +
        +
        + <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> +
        +
        +
        + <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
        +
        +
        +
        +
        + + + diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb index 2def5c5f8..06982ccfc 100644 --- a/app/views/org_subfields/update.js.erb +++ b/app/views/org_subfields/update.js.erb @@ -1 +1,3 @@ -$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); \ No newline at end of file +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); +$("#sub_field_left_lists").html(""); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 52201fd52..3bfabf5ae 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -1,49 +1,21 @@ +
        + <%= link_to "组织首页",organization_path(@organization, :show_homepage => 1), :class => 'homepageMenuText', :target => '_blank' %> +
        <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
        项目 <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - - - - - - - - - - - - -
          <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> - - - -
        课程 <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%> - - - - - - - - - - - - -
          diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 9e0fc365c..9ee9d11c0 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -12,6 +12,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} +<% if params[:show_homepage].nil? %>
          最新动态
            @@ -49,9 +50,8 @@
        -
        - +<% end %> <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> " + end + + ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg') + if opt[:enable_at] + ss += javascript_include_tag('/assets/kindeditor/at/jquery.caret.min.js', '/assets/kindeditor/at/jquery.atwho.js', '/assets/kindeditor/at/config.js') + ss += stylesheet_link_tag("/assets/kindeditor/at/jquery.atwho.css") + end + + if opt[:prettify] + ss += javascript_include_tag 'prettify' + ss += stylesheet_link_tag 'prettify' + end + + if opt[:init_activity] + ss += javascript_include_tag "init_activity_KindEditor" + end + + ss.html_safe + end + end diff --git a/app/models/user.rb b/app/models/user.rb index 9c437a186..65c0bf858 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -409,10 +409,14 @@ class User < Principal else name = lastname+firstname end - name = name.empty? || name.nil? ? login : name - name + name.empty? || name.nil? ? login : name end ## end + + def get_at_show_name + name = show_name + name = "#{name} #{self.login}" if name != self.login + end #added by nie def count_new_journal_reply diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 76e178120..80d3aaac1 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> +<%= import_ke(enable_at: true) %> +<% end %> +

        <%= l(:label_issue_edit) %>

        diff --git a/db/schema.rb b/db/schema.rb index 6cc6b90c4..e41c8b64e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151204062220) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -891,16 +894,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) 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" @@ -970,7 +963,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index eef2eb576..08f4da0ad 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -1,5 +1,6 @@ module RailsKindeditor module Helper + EVAL_STR = %Q|eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin("autoheight")})| def kindeditor_tag(name, content = nil, options = {}) id = sanitize_to_id(name) @@ -9,7 +10,7 @@ module RailsKindeditor output << text_area_tag(name, content, input_html) output << javascript_tag(js_replace(id, options.merge(window_onload: 'true', :autoHeightMode=>true, - afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})', + afterCreate: EVAL_STR, emotionsBasePath: 'http://' + Setting.host_name ))) end @@ -22,7 +23,7 @@ module RailsKindeditor output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true', :autoHeightMode=>true, - afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})', + afterCreate: EVAL_STR, emotionsBasePath: 'http://' + Setting.host_name ))) end diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js new file mode 100644 index 000000000..8ca9b117f --- /dev/null +++ b/public/assets/kindeditor/at/config.js @@ -0,0 +1,39 @@ +function enableAt(_editor) { + var editor = _editor; + if(editor.edit == undefined || editor.edit.iframe == undefined){ + return; + } + + var ifr = editor.edit.iframe[0]; + var doc = ifr.contentDocument || iframe.contentWindow.document; + var ifrBody = doc.body; + ifrBody.contentEditable = true; + + console.log("enable at"); + + $.fn.atwho.debug = true; + + if(!atPersonLists){ + return; + } + var names = atPersonLists; + + //var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"]; + // + //var names = $.map(names,function(value,i) { + // return {'id':i,'name':value,'email':value+"@email.com"}; + //}); + + var at_config = { + at: "@", + data: names, + insertTpl: '@${name}', + displayTpl: "
      • ${name} ${email}
      • ", + limit: 200 + } + + $inputor = $(ifrBody).atwho(at_config); + window.aaa= $inputor; + $inputor.caret('pos', 47); + $inputor.focus().atwho('run'); +}; diff --git a/public/assets/kindeditor/at/jquery.atwho.css b/public/assets/kindeditor/at/jquery.atwho.css new file mode 100644 index 000000000..a07390887 --- /dev/null +++ b/public/assets/kindeditor/at/jquery.atwho.css @@ -0,0 +1,49 @@ +.atwho-view { + position:absolute; + top: 0; + left: 0; + display: none; + margin-top: 18px; + background: white; + color: black; + border: 1px solid #DDD; + border-radius: 3px; + box-shadow: 0 0 5px rgba(0,0,0,0.1); + min-width: 120px; + max-height: 200px; + overflow: auto; + z-index: 11110 !important; +} + +.atwho-view .cur { + background: #3366FF; + color: white; +} +.atwho-view .cur small { + color: white; +} +.atwho-view strong { + color: #3366FF; +} +.atwho-view .cur strong { + color: white; + font:bold; +} +.atwho-view ul { + /* width: 100px; */ + list-style:none; + padding:0; + margin:auto; +} +.atwho-view ul li { + display: block; + padding: 5px 10px; + border-bottom: 1px solid #DDD; + cursor: pointer; + /* border-top: 1px solid #C8C8C8; */ +} +.atwho-view small { + font-size: smaller; + color: #777; + font-weight: normal; +} diff --git a/public/assets/kindeditor/at/jquery.atwho.js b/public/assets/kindeditor/at/jquery.atwho.js new file mode 100644 index 000000000..1e6c8ec25 --- /dev/null +++ b/public/assets/kindeditor/at/jquery.atwho.js @@ -0,0 +1,1161 @@ +/*! jquery.atwho - v1.4.0 %> +* Copyright (c) 2015 chord.luo ; +* homepage: http://ichord.github.com/At.js +* Licensed MIT +*/ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function (a0) { + return (factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + factory(jQuery); + } +}(this, function (jquery) { + +var $, Api, App, Controller, DEFAULT_CALLBACKS, EditableController, KEY_CODE, Model, TextareaController, View, + slice = [].slice, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +$ = jquery; + +App = (function() { + function App(inputor) { + this.currentFlag = null; + this.controllers = {}; + this.aliasMaps = {}; + this.$inputor = $(inputor); + this.setupRootElement(); + this.listen(); + } + + App.prototype.createContainer = function(doc) { + var ref; + if ((ref = this.$el) != null) { + ref.remove(); + } + return $(doc.body).append(this.$el = $("
        ")); + }; + + App.prototype.setupRootElement = function(iframe, asRoot) { + var error; + if (asRoot == null) { + asRoot = false; + } + if (iframe) { + this.window = iframe.contentWindow; + this.document = iframe.contentDocument || this.window.document; + this.iframe = iframe; + } else { + this.document = this.$inputor[0].ownerDocument; + this.window = this.document.defaultView || this.document.parentWindow; + try { + this.iframe = this.window.frameElement; + } catch (_error) { + error = _error; + this.iframe = null; + if ($.fn.atwho.debug) { + throw new Error("iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n" + error); + } + } + } + return this.createContainer((this.iframeAsRoot = asRoot) ? this.document : document); + }; + + App.prototype.controller = function(at) { + var c, current, currentFlag, ref; + if (this.aliasMaps[at]) { + current = this.controllers[this.aliasMaps[at]]; + } else { + ref = this.controllers; + for (currentFlag in ref) { + c = ref[currentFlag]; + if (currentFlag === at) { + current = c; + break; + } + } + } + if (current) { + return current; + } else { + return this.controllers[this.currentFlag]; + } + }; + + App.prototype.setContextFor = function(at) { + this.currentFlag = at; + return this; + }; + + App.prototype.reg = function(flag, setting) { + var base, controller; + controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[contentEditable]') ? new EditableController(this, flag) : new TextareaController(this, flag)); + if (setting.alias) { + this.aliasMaps[setting.alias] = flag; + } + controller.init(setting); + return this; + }; + + App.prototype.listen = function() { + return this.$inputor.on('compositionstart', (function(_this) { + return function(e) { + var ref; + if ((ref = _this.controller()) != null) { + ref.view.hide(); + } + _this.isComposing = true; + return null; + }; + })(this)).on('compositionend', (function(_this) { + return function(e) { + _this.isComposing = false; + return null; + }; + })(this)).on('keyup.atwhoInner', (function(_this) { + return function(e) { + return _this.onKeyup(e); + }; + })(this)).on('keydown.atwhoInner', (function(_this) { + return function(e) { + return _this.onKeydown(e); + }; + })(this)).on('blur.atwhoInner', (function(_this) { + return function(e) { + var c; + if (c = _this.controller()) { + c.expectedQueryCBId = null; + return c.view.hide(e, c.getOpt("displayTimeout")); + } + }; + })(this)).on('click.atwhoInner', (function(_this) { + return function(e) { + return _this.dispatch(e); + }; + })(this)).on('scroll.atwhoInner', (function(_this) { + return function() { + var lastScrollTop; + lastScrollTop = _this.$inputor.scrollTop(); + return function(e) { + var currentScrollTop, ref; + currentScrollTop = e.target.scrollTop; + if (lastScrollTop !== currentScrollTop) { + if ((ref = _this.controller()) != null) { + ref.view.hide(e); + } + } + lastScrollTop = currentScrollTop; + return true; + }; + }; + })(this)()); + }; + + App.prototype.shutdown = function() { + var _, c, ref; + ref = this.controllers; + for (_ in ref) { + c = ref[_]; + c.destroy(); + delete this.controllers[_]; + } + this.$inputor.off('.atwhoInner'); + return this.$el.remove(); + }; + + App.prototype.dispatch = function(e) { + var _, c, ref, results; + ref = this.controllers; + results = []; + for (_ in ref) { + c = ref[_]; + results.push(c.lookUp(e)); + } + return results; + }; + + App.prototype.onKeyup = function(e) { + var ref; + switch (e.keyCode) { + case KEY_CODE.ESC: + e.preventDefault(); + if ((ref = this.controller()) != null) { + ref.view.hide(); + } + break; + case KEY_CODE.DOWN: + case KEY_CODE.UP: + case KEY_CODE.CTRL: + case KEY_CODE.ENTER: + $.noop(); + break; + case KEY_CODE.P: + case KEY_CODE.N: + if (!e.ctrlKey) { + this.dispatch(e); + } + break; + default: + this.dispatch(e); + } + }; + + App.prototype.onKeydown = function(e) { + var ref, view; + view = (ref = this.controller()) != null ? ref.view : void 0; + if (!(view && view.visible())) { + return; + } + switch (e.keyCode) { + case KEY_CODE.ESC: + e.preventDefault(); + view.hide(e); + break; + case KEY_CODE.UP: + e.preventDefault(); + view.prev(); + break; + case KEY_CODE.DOWN: + e.preventDefault(); + view.next(); + break; + case KEY_CODE.P: + if (!e.ctrlKey) { + return; + } + e.preventDefault(); + view.prev(); + break; + case KEY_CODE.N: + if (!e.ctrlKey) { + return; + } + e.preventDefault(); + view.next(); + break; + case KEY_CODE.TAB: + case KEY_CODE.ENTER: + case KEY_CODE.SPACE: + if (!view.visible()) { + return; + } + if (!this.controller().getOpt('spaceSelectsMatch') && e.keyCode === KEY_CODE.SPACE) { + return; + } + if (!this.controller().getOpt('tabSelectsMatch') && e.keyCode === KEY_CODE.TAB) { + return; + } + if (view.highlighted()) { + e.preventDefault(); + view.choose(e); + } else { + view.hide(e); + } + break; + default: + $.noop(); + } + }; + + return App; + +})(); + +Controller = (function() { + Controller.prototype.uid = function() { + return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime()); + }; + + function Controller(app1, at1) { + this.app = app1; + this.at = at1; + this.$inputor = this.app.$inputor; + this.id = this.$inputor[0].id || this.uid(); + this.expectedQueryCBId = null; + this.setting = null; + this.query = null; + this.pos = 0; + this.range = null; + if ((this.$el = $("#atwho-ground-" + this.id, this.app.$el)).length === 0) { + this.app.$el.append(this.$el = $("
        ")); + } + this.model = new Model(this); + this.view = new View(this); + } + + Controller.prototype.init = function(setting) { + this.setting = $.extend({}, this.setting || $.fn.atwho["default"], setting); + this.view.init(); + return this.model.reload(this.setting.data); + }; + + Controller.prototype.destroy = function() { + this.trigger('beforeDestroy'); + this.model.destroy(); + this.view.destroy(); + return this.$el.remove(); + }; + + Controller.prototype.callDefault = function() { + var args, error, funcName; + funcName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; + try { + return DEFAULT_CALLBACKS[funcName].apply(this, args); + } catch (_error) { + error = _error; + return $.error(error + " Or maybe At.js doesn't have function " + funcName); + } + }; + + Controller.prototype.trigger = function(name, data) { + var alias, eventName; + if (data == null) { + data = []; + } + data.push(this); + alias = this.getOpt('alias'); + eventName = alias ? name + "-" + alias + ".atwho" : name + ".atwho"; + return this.$inputor.trigger(eventName, data); + }; + + Controller.prototype.callbacks = function(funcName) { + return this.getOpt("callbacks")[funcName] || DEFAULT_CALLBACKS[funcName]; + }; + + Controller.prototype.getOpt = function(at, default_value) { + var e; + try { + return this.setting[at]; + } catch (_error) { + e = _error; + return null; + } + }; + + Controller.prototype.insertContentFor = function($li) { + var data, tpl; + tpl = this.getOpt('insertTpl'); + data = $.extend({}, $li.data('item-data'), { + 'atwho-at': this.at + }); + return this.callbacks("tplEval").call(this, tpl, data, "onInsert"); + }; + + Controller.prototype.renderView = function(data) { + var searchKey; + searchKey = this.getOpt("searchKey"); + data = this.callbacks("sorter").call(this, this.query.text, data.slice(0, 1001), searchKey); + return this.view.render(data.slice(0, this.getOpt('limit'))); + }; + + Controller.arrayToDefaultHash = function(data) { + var i, item, len, results; + if (!$.isArray(data)) { + return data; + } + results = []; + for (i = 0, len = data.length; i < len; i++) { + item = data[i]; + if ($.isPlainObject(item)) { + results.push(item); + } else { + results.push({ + name: item + }); + } + } + return results; + }; + + Controller.prototype.lookUp = function(e) { + var query, wait; + if (e && e.type === 'click' && !this.getOpt('lookUpOnClick')) { + return; + } + if (this.getOpt('suspendOnComposing') && this.app.isComposing) { + return; + } + query = this.catchQuery(e); + if (!query) { + this.expectedQueryCBId = null; + return query; + } + this.app.setContextFor(this.at); + if (wait = this.getOpt('delay')) { + this._delayLookUp(query, wait); + } else { + this._lookUp(query); + } + return query; + }; + + Controller.prototype._delayLookUp = function(query, wait) { + var now, remaining; + now = Date.now ? Date.now() : new Date().getTime(); + this.previousCallTime || (this.previousCallTime = now); + remaining = wait - (now - this.previousCallTime); + if ((0 < remaining && remaining < wait)) { + this.previousCallTime = now; + this._stopDelayedCall(); + return this.delayedCallTimeout = setTimeout((function(_this) { + return function() { + _this.previousCallTime = 0; + _this.delayedCallTimeout = null; + return _this._lookUp(query); + }; + })(this), wait); + } else { + this._stopDelayedCall(); + if (this.previousCallTime !== now) { + this.previousCallTime = 0; + } + return this._lookUp(query); + } + }; + + Controller.prototype._stopDelayedCall = function() { + if (this.delayedCallTimeout) { + clearTimeout(this.delayedCallTimeout); + return this.delayedCallTimeout = null; + } + }; + + Controller.prototype._generateQueryCBId = function() { + return {}; + }; + + Controller.prototype._lookUp = function(query) { + var _callback; + _callback = function(queryCBId, data) { + if (queryCBId !== this.expectedQueryCBId) { + return; + } + if (data && data.length > 0) { + return this.renderView(this.constructor.arrayToDefaultHash(data)); + } else { + return this.view.hide(); + } + }; + this.expectedQueryCBId = this._generateQueryCBId(); + return this.model.query(query.text, $.proxy(_callback, this, this.expectedQueryCBId)); + }; + + return Controller; + +})(); + +TextareaController = (function(superClass) { + extend(TextareaController, superClass); + + function TextareaController() { + return TextareaController.__super__.constructor.apply(this, arguments); + } + + TextareaController.prototype.catchQuery = function() { + var caretPos, content, end, isString, query, start, subtext; + content = this.$inputor.val(); + caretPos = this.$inputor.caret('pos', { + iframe: this.app.iframe + }); + subtext = content.slice(0, caretPos); + query = this.callbacks("matcher").call(this, this.at, subtext, this.getOpt('startWithSpace')); + isString = typeof query === 'string'; + if (isString && query.length < this.getOpt('minLen', 0)) { + return; + } + if (isString && query.length <= this.getOpt('maxLen', 20)) { + start = caretPos - query.length; + end = start + query.length; + this.pos = start; + query = { + 'text': query, + 'headPos': start, + 'endPos': end + }; + this.trigger("matched", [this.at, query.text]); + } else { + query = null; + this.view.hide(); + } + return this.query = query; + }; + + TextareaController.prototype.rect = function() { + var c, iframeOffset, scaleBottom; + if (!(c = this.$inputor.caret('offset', this.pos - 1, { + iframe: this.app.iframe + }))) { + return; + } + if (this.app.iframe && !this.app.iframeAsRoot) { + iframeOffset = $(this.app.iframe).offset(); + c.left += iframeOffset.left; + c.top += iframeOffset.top; + } + scaleBottom = this.app.document.selection ? 0 : 2; + return { + left: c.left, + top: c.top, + bottom: c.top + c.height + scaleBottom + }; + }; + + TextareaController.prototype.insert = function(content, $li) { + var $inputor, source, startStr, suffix, text; + $inputor = this.$inputor; + source = $inputor.val(); + startStr = source.slice(0, Math.max(this.query.headPos - this.at.length, 0)); + suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || " "; + content += suffix; + text = "" + startStr + content + (source.slice(this.query['endPos'] || 0)); + $inputor.val(text); + $inputor.caret('pos', startStr.length + content.length, { + iframe: this.app.iframe + }); + if (!$inputor.is(':focus')) { + $inputor.focus(); + } + return $inputor.change(); + }; + + return TextareaController; + +})(Controller); + +EditableController = (function(superClass) { + extend(EditableController, superClass); + + function EditableController() { + return EditableController.__super__.constructor.apply(this, arguments); + } + + EditableController.prototype._getRange = function() { + var sel; + sel = this.app.window.getSelection(); + if (sel.rangeCount > 0) { + return sel.getRangeAt(0); + } + }; + + EditableController.prototype._setRange = function(position, node, range) { + if (range == null) { + range = this._getRange(); + } + if (!range) { + return; + } + node = $(node)[0]; + if (position === 'after') { + range.setEndAfter(node); + range.setStartAfter(node); + } else { + range.setEndBefore(node); + range.setStartBefore(node); + } + range.collapse(false); + return this._clearRange(range); + }; + + EditableController.prototype._clearRange = function(range) { + var sel; + if (range == null) { + range = this._getRange(); + } + sel = this.app.window.getSelection(); + if (this.ctrl_a_pressed == null) { + sel.removeAllRanges(); + return sel.addRange(range); + } + }; + + EditableController.prototype._movingEvent = function(e) { + var ref; + return e.type === 'click' || ((ref = e.which) === KEY_CODE.RIGHT || ref === KEY_CODE.LEFT || ref === KEY_CODE.UP || ref === KEY_CODE.DOWN); + }; + + EditableController.prototype._unwrap = function(node) { + var next; + node = $(node).unwrap().get(0); + if ((next = node.nextSibling) && next.nodeValue) { + node.nodeValue += next.nodeValue; + $(next).remove(); + } + return node; + }; + + EditableController.prototype.catchQuery = function(e) { + var $inserted, $query, _range, index, inserted, isString, lastNode, matched, offset, query, query_content, range; + if (!(range = this._getRange())) { + return; + } + if (!range.collapsed) { + return; + } + if(!e){ + return; + } + if (e.which === KEY_CODE.ENTER) { + ($query = $(range.startContainer).closest('.atwho-query')).contents().unwrap(); + if ($query.is(':empty')) { + $query.remove(); + } + ($query = $(".atwho-query", this.app.document)).text($query.text()).contents().last().unwrap(); + this._clearRange(); + return; + } + if (/firefox/i.test(navigator.userAgent)) { + if ($(range.startContainer).is(this.$inputor)) { + this._clearRange(); + return; + } + if (e.which === KEY_CODE.BACKSPACE && range.startContainer.nodeType === document.ELEMENT_NODE && (offset = range.startOffset - 1) >= 0) { + _range = range.cloneRange(); + _range.setStart(range.startContainer, offset); + if ($(_range.cloneContents()).contents().last().is('.atwho-inserted')) { + inserted = $(range.startContainer).contents().get(offset); + this._setRange('after', $(inserted).contents().last()); + } + } else if (e.which === KEY_CODE.LEFT && range.startContainer.nodeType === document.TEXT_NODE) { + $inserted = $(range.startContainer.previousSibling); + if ($inserted.is('.atwho-inserted') && range.startOffset === 0) { + this._setRange('after', $inserted.contents().last()); + } + } + } + $(range.startContainer).closest('.atwho-inserted').addClass('atwho-query').siblings().removeClass('atwho-query'); + if (($query = $(".atwho-query", this.app.document)).length > 0 && $query.is(':empty') && $query.text().length === 0) { + $query.remove(); + } + if (!this._movingEvent(e)) { + $query.removeClass('atwho-inserted'); + } + if ($query.length > 0) { + switch (e.which) { + case KEY_CODE.LEFT: + this._setRange('before', $query.get(0), range); + $query.removeClass('atwho-query'); + return; + case KEY_CODE.RIGHT: + this._setRange('after', $query.get(0).nextSibling, range); + $query.removeClass('atwho-query'); + return; + } + } + if ($query.length > 0 && (query_content = $query.attr('data-atwho-at-query'))) { + $query.empty().html(query_content).attr('data-atwho-at-query', null); + this._setRange('after', $query.get(0), range); + } + _range = range.cloneRange(); + _range.setStart(range.startContainer, 0); + matched = this.callbacks("matcher").call(this, this.at, _range.toString(), this.getOpt('startWithSpace')); + isString = typeof matched === 'string'; + if ($query.length === 0 && isString && (index = range.startOffset - this.at.length - matched.length) >= 0) { + range.setStart(range.startContainer, index); + $query = $('', this.app.document).attr(this.getOpt("editableAtwhoQueryAttrs")).addClass('atwho-query'); + range.surroundContents($query.get(0)); + lastNode = $query.contents().last().get(0); + if (/firefox/i.test(navigator.userAgent)) { + range.setStart(lastNode, lastNode.length); + range.setEnd(lastNode, lastNode.length); + this._clearRange(range); + } else { + this._setRange('after', lastNode, range); + } + } + if (isString && matched.length < this.getOpt('minLen', 0)) { + return; + } + if (isString && matched.length <= this.getOpt('maxLen', 20)) { + query = { + text: matched, + el: $query + }; + this.trigger("matched", [this.at, query.text]); + return this.query = query; + } else { + this.view.hide(); + this.query = { + el: $query + }; + if ($query.text().indexOf(this.at) >= 0) { + if (this._movingEvent(e) && $query.hasClass('atwho-inserted')) { + $query.removeClass('atwho-query'); + } else if (false !== this.callbacks('afterMatchFailed').call(this, this.at, $query)) { + this._setRange("after", this._unwrap($query.text($query.text()).contents().first())); + } + } + return null; + } + }; + + EditableController.prototype.rect = function() { + var $iframe, iframeOffset, rect; + rect = this.query.el.offset(); + if (this.app.iframe && !this.app.iframeAsRoot) { + iframeOffset = ($iframe = $(this.app.iframe)).offset(); + rect.left += iframeOffset.left - this.$inputor.scrollLeft(); + rect.top += iframeOffset.top - this.$inputor.scrollTop(); + } + rect.bottom = rect.top + this.query.el.height(); + return rect; + }; + + EditableController.prototype.insert = function(content, $li) { + var data, range, suffix, suffixNode; + suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0"; + data = $li.data('item-data'); + this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text); + if (range = this._getRange()) { + range.setEndAfter(this.query.el[0]); + range.collapse(false); + range.insertNode(suffixNode = this.app.document.createTextNode("\u200D" + suffix)); + this._setRange('after', suffixNode, range); + } + if (!this.$inputor.is(':focus')) { + this.$inputor.focus(); + } + return this.$inputor.change(); + }; + + return EditableController; + +})(Controller); + +Model = (function() { + function Model(context) { + this.context = context; + this.at = this.context.at; + this.storage = this.context.$inputor; + } + + Model.prototype.destroy = function() { + return this.storage.data(this.at, null); + }; + + Model.prototype.saved = function() { + return this.fetch() > 0; + }; + + Model.prototype.query = function(query, callback) { + var _remoteFilter, data, searchKey; + data = this.fetch(); + searchKey = this.context.getOpt("searchKey"); + data = this.context.callbacks('filter').call(this.context, query, data, searchKey) || []; + _remoteFilter = this.context.callbacks('remoteFilter'); + if (data.length > 0 || (!_remoteFilter && data.length === 0)) { + return callback(data); + } else { + return _remoteFilter.call(this.context, query, callback); + } + }; + + Model.prototype.fetch = function() { + return this.storage.data(this.at) || []; + }; + + Model.prototype.save = function(data) { + return this.storage.data(this.at, this.context.callbacks("beforeSave").call(this.context, data || [])); + }; + + Model.prototype.load = function(data) { + if (!(this.saved() || !data)) { + return this._load(data); + } + }; + + Model.prototype.reload = function(data) { + return this._load(data); + }; + + Model.prototype._load = function(data) { + if (typeof data === "string") { + return $.ajax(data, { + dataType: "json" + }).done((function(_this) { + return function(data) { + return _this.save(data); + }; + })(this)); + } else { + return this.save(data); + } + }; + + return Model; + +})(); + +View = (function() { + function View(context) { + this.context = context; + this.$el = $("
          "); + this.timeoutID = null; + this.context.$el.append(this.$el); + this.bindEvent(); + } + + View.prototype.init = function() { + var id; + id = this.context.getOpt("alias") || this.context.at.charCodeAt(0); + return this.$el.attr({ + 'id': "at-view-" + id + }); + }; + + View.prototype.destroy = function() { + return this.$el.remove(); + }; + + View.prototype.bindEvent = function() { + var $menu; + $menu = this.$el.find('ul'); + return $menu.on('mouseenter.atwho-view', 'li', function(e) { + $menu.find('.cur').removeClass('cur'); + return $(e.currentTarget).addClass('cur'); + }).on('click.atwho-view', 'li', (function(_this) { + return function(e) { + $menu.find('.cur').removeClass('cur'); + $(e.currentTarget).addClass('cur'); + _this.choose(e); + return e.preventDefault(); + }; + })(this)); + }; + + View.prototype.visible = function() { + return this.$el.is(":visible"); + }; + + View.prototype.highlighted = function() { + return this.$el.find(".cur").length > 0; + }; + + View.prototype.choose = function(e) { + var $li, content; + if (($li = this.$el.find(".cur")).length) { + content = this.context.insertContentFor($li); + this.context._stopDelayedCall(); + this.context.insert(this.context.callbacks("beforeInsert").call(this.context, content, $li), $li); + this.context.trigger("inserted", [$li, e]); + this.hide(e); + } + if (this.context.getOpt("hideWithoutSuffix")) { + return this.stopShowing = true; + } + }; + + View.prototype.reposition = function(rect) { + var _window, offset, overflowOffset, ref; + _window = this.context.app.iframeAsRoot ? this.context.app.window : window; + if (rect.bottom + this.$el.height() - $(_window).scrollTop() > $(_window).height()) { + rect.bottom = rect.top - this.$el.height(); + } + if (rect.left > (overflowOffset = $(_window).width() - this.$el.width() - 5)) { + rect.left = overflowOffset; + } + offset = { + left: rect.left, + top: rect.bottom + }; + if ((ref = this.context.callbacks("beforeReposition")) != null) { + ref.call(this.context, offset); + } + this.$el.offset(offset); + return this.context.trigger("reposition", [offset]); + }; + + View.prototype.next = function() { + var cur, next; + cur = this.$el.find('.cur').removeClass('cur'); + next = cur.next(); + if (!next.length) { + next = this.$el.find('li:first'); + } + next.addClass('cur'); + return this.scrollTop(Math.max(0, cur.innerHeight() * (next.index() + 2) - this.$el.height())); + }; + + View.prototype.prev = function() { + var cur, prev; + cur = this.$el.find('.cur').removeClass('cur'); + prev = cur.prev(); + if (!prev.length) { + prev = this.$el.find('li:last'); + } + prev.addClass('cur'); + return this.scrollTop(Math.max(0, cur.innerHeight() * (prev.index() + 2) - this.$el.height())); + }; + + View.prototype.scrollTop = function(scrollTop) { + var scrollDuration; + scrollDuration = this.context.getOpt('scrollDuration'); + if (scrollDuration) { + return this.$el.animate({ + scrollTop: scrollTop + }, scrollDuration); + } else { + return this.$el.scrollTop(scrollTop); + } + }; + + View.prototype.show = function() { + var rect; + if (this.stopShowing) { + this.stopShowing = false; + return; + } + if (!this.visible()) { + this.$el.show(); + this.$el.scrollTop(0); + this.context.trigger('shown'); + } + if (rect = this.context.rect()) { + return this.reposition(rect); + } + }; + + View.prototype.hide = function(e, time) { + var callback; + if (!this.visible()) { + return; + } + if (isNaN(time)) { + this.$el.hide(); + return this.context.trigger('hidden', [e]); + } else { + callback = (function(_this) { + return function() { + return _this.hide(); + }; + })(this); + clearTimeout(this.timeoutID); + return this.timeoutID = setTimeout(callback, time); + } + }; + + View.prototype.render = function(list) { + var $li, $ul, i, item, len, li, tpl; + if (!($.isArray(list) && list.length > 0)) { + this.hide(); + return; + } + this.$el.find('ul').empty(); + $ul = this.$el.find('ul'); + tpl = this.context.getOpt('displayTpl'); + for (i = 0, len = list.length; i < len; i++) { + item = list[i]; + item = $.extend({}, item, { + 'atwho-at': this.context.at + }); + li = this.context.callbacks("tplEval").call(this.context, tpl, item, "onDisplay"); + $li = $(this.context.callbacks("highlighter").call(this.context, li, this.context.query.text)); + $li.data("item-data", item); + $ul.append($li); + } + this.show(); + if (this.context.getOpt('highlightFirst')) { + return $ul.find("li:first").addClass("cur"); + } + }; + + return View; + +})(); + +KEY_CODE = { + DOWN: 40, + UP: 38, + ESC: 27, + TAB: 9, + ENTER: 13, + CTRL: 17, + A: 65, + P: 80, + N: 78, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + BACKSPACE: 8, + SPACE: 32 +}; + +DEFAULT_CALLBACKS = { + beforeSave: function(data) { + return Controller.arrayToDefaultHash(data); + }, + matcher: function(flag, subtext, should_startWithSpace, acceptSpaceBar) { + var _a, _y, match, regexp, space; + flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + if (should_startWithSpace) { + flag = '(?:^|\\s)' + flag; + } + _a = decodeURI("%C3%80"); + _y = decodeURI("%C3%BF"); + space = acceptSpaceBar ? "\ " : ""; + regexp = new RegExp(flag + "([A-Za-z" + _a + "-" + _y + "0-9_" + space + "\'\.\+\-]*)$|" + flag + "([^\\x00-\\xff]*)$", 'gi'); + match = regexp.exec(subtext); + if (match) { + return match[2] || match[1]; + } else { + return null; + } + }, + filter: function(query, data, searchKey) { + var _results, i, item, len; + _results = []; + for (i = 0, len = data.length; i < len; i++) { + item = data[i]; + if (~new String(item[searchKey]).toLowerCase().indexOf(query.toLowerCase())) { + _results.push(item); + } + } + return _results; + }, + remoteFilter: null, + sorter: function(query, items, searchKey) { + var _results, i, item, len; + if (!query) { + return items; + } + _results = []; + for (i = 0, len = items.length; i < len; i++) { + item = items[i]; + item.atwho_order = new String(item[searchKey]).toLowerCase().indexOf(query.toLowerCase()); + if (item.atwho_order > -1) { + _results.push(item); + } + } + return _results.sort(function(a, b) { + return a.atwho_order - b.atwho_order; + }); + }, + tplEval: function(tpl, map) { + var error, template; + template = tpl; + try { + if (typeof tpl !== 'string') { + template = tpl(map); + } + return template.replace(/\$\{([^\}]*)\}/g, function(tag, key, pos) { + return map[key]; + }); + } catch (_error) { + error = _error; + return ""; + } + }, + highlighter: function(li, query) { + var regexp; + if (!query) { + return li; + } + regexp = new RegExp(">\\s*(\\w*?)(" + query.replace("+", "\\+") + ")(\\w*)\\s*<", 'ig'); + return li.replace(regexp, function(str, $1, $2, $3) { + return '> ' + $1 + '' + $2 + '' + $3 + ' <'; + }); + }, + beforeInsert: function(value, $li) { + return value; + }, + beforeReposition: function(offset) { + return offset; + }, + afterMatchFailed: function(at, el) {} +}; + +Api = { + load: function(at, data) { + var c; + if (c = this.controller(at)) { + return c.model.load(data); + } + }, + isSelecting: function() { + var ref; + return !!((ref = this.controller()) != null ? ref.view.visible() : void 0); + }, + hide: function() { + var ref; + return (ref = this.controller()) != null ? ref.view.hide() : void 0; + }, + reposition: function() { + var c; + if (c = this.controller()) { + return c.view.reposition(c.rect()); + } + }, + setIframe: function(iframe, asRoot) { + this.setupRootElement(iframe, asRoot); + return null; + }, + run: function() { + return this.dispatch(); + }, + destroy: function() { + this.shutdown(); + return this.$inputor.data('atwho', null); + } +}; + +$.fn.atwho = function(method) { + var _args, result; + _args = arguments; + result = null; + this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function() { + var $this, app; + if (!(app = ($this = $(this)).data("atwho"))) { + $this.data('atwho', (app = new App(this))); + } + if (typeof method === 'object' || !method) { + return app.reg(method.at, method); + } else if (Api[method] && app) { + return result = Api[method].apply(app, Array.prototype.slice.call(_args, 1)); + } else { + return $.error("Method " + method + " does not exist on jQuery.atwho"); + } + }); + if (result != null) { + return result; + } else { + return this; + } +}; + +$.fn.atwho["default"] = { + at: void 0, + alias: void 0, + data: null, + displayTpl: "
        • ${name}
        • ", + insertTpl: "${atwho-at}${name}", + callbacks: DEFAULT_CALLBACKS, + searchKey: "name", + suffix: void 0, + hideWithoutSuffix: false, + startWithSpace: true, + highlightFirst: true, + limit: 5, + maxLen: 20, + minLen: 0, + displayTimeout: 300, + delay: null, + spaceSelectsMatch: false, + tabSelectsMatch: true, + editableAtwhoQueryAttrs: {}, + scrollDuration: 150, + suspendOnComposing: true, + lookUpOnClick: true +}; + +$.fn.atwho.debug = false; + + +})); From 3d2ac4b59f8447ddb6fbd0965ca4197fffc8a7c0 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 6 Dec 2015 15:03:36 +0800 Subject: [PATCH 161/913] =?UTF-8?q?KE=E5=BC=95=E7=94=A8=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=BD=BF=E7=94=A8import=5Fke?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/messages.html.erb | 4 +++- app/views/bids/edit.html.erb | 6 ++++-- app/views/blog_comments/_edit.html.erb | 8 ++++++-- app/views/blog_comments/_new.html.erb | 5 ++++- app/views/blog_comments/_reply_form.html.erb | 4 +++- app/views/blog_comments/show.html.erb | 5 ++++- app/views/blogs/_article_list.html.erb | 6 +++++- app/views/blogs/index.html.erb | 3 +-- app/views/boards/_course_new.html.erb | 5 ++++- app/views/boards/_course_show.html.erb | 6 +++++- app/views/boards/show.html.erb | 5 +++-- app/views/courses/_course_activity.html.erb | 5 ++++- app/views/courses/_courses_jours.html.erb | 6 +++++- app/views/courses/syllabus.html.erb | 7 ++++++- app/views/forums/edit.html.erb | 5 ++++- app/views/forums/new.html.erb | 3 ++- app/views/forums/show.html.erb | 6 +++++- app/views/issues/_edit.html.erb | 6 +++++- app/views/issues/new.html.erb | 6 +++++- app/views/layouts/base_forums.html.erb | 5 ++++- app/views/layouts/base_projects.html.erb | 1 + app/views/memos/edit.html.erb | 7 ++++++- app/views/memos/new.html.erb | 8 ++++++-- app/views/memos/show.html.erb | 7 ++++++- app/views/messages/_course_show.html.erb | 5 ++++- app/views/messages/_form_course.html.erb | 5 ++++- app/views/news/_course_form.html.erb | 5 ++++- app/views/news/_course_show.html.erb | 5 ++++- app/views/news/_project_form.html.erb | 5 ++++- app/views/news/edit.html.erb | 5 ++++- app/views/org_document_comments/_new.html.erb | 5 ++++- app/views/org_document_comments/edit.html.erb | 5 ++++- app/views/org_document_comments/index.html.erb | 5 ++++- app/views/org_document_comments/new.html.erb | 5 ++++- app/views/org_document_comments/show.html.erb | 6 +++++- app/views/organizations/show.html.erb | 6 +++++- app/views/projects/_project_jours.html.erb | 5 ++++- app/views/users/_user_activities.html.erb | 5 ++++- app/views/users/_user_homework_form.html.erb | 3 ++- app/views/users/_user_homework_list.html.erb | 5 ++++- app/views/users/_user_jours.html.erb | 5 ++++- app/views/users/user_newfeedback.html.erb | 6 +++++- 42 files changed, 174 insertions(+), 46 deletions(-) diff --git a/app/views/admin/messages.html.erb b/app/views/admin/messages.html.erb index f87741dd9..e4d053d49 100644 --- a/app/views/admin/messages.html.erb +++ b/app/views/admin/messages.html.erb @@ -1,4 +1,6 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false) %> +<% end %>

          <%=l(:label_system_message)%>


          diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index 554702d97..9fb8cbc59 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -1,5 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'prettify','/assets/kindeditor/pasteimg' %> -<%= stylesheet_link_tag 'prettify'%> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: true) %> +<% end %> + <%= labelled_form_for @bid,:html => { :multipart => true } do |f| %> <%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %> <% end %> diff --git a/app/views/blog_comments/_edit.html.erb b/app/views/blog_comments/_edit.html.erb index 375c948d4..c7065ece4 100644 --- a/app/views/blog_comments/_edit.html.erb +++ b/app/views/blog_comments/_edit.html.erb @@ -1,9 +1,13 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'blog' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag 'blog' %> +<% end %> +
          - +

          diff --git a/app/views/blog_comments/_new.html.erb b/app/views/blog_comments/_new.html.erb index 48f152c4e..863760b35 100644 --- a/app/views/blog_comments/_new.html.erb +++ b/app/views/blog_comments/_new.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'blog' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag 'blog' %> +<% end %>
          diff --git a/app/views/blog_comments/_reply_form.html.erb b/app/views/blog_comments/_reply_form.html.erb index cc4c0e952..32f4333c2 100644 --- a/app/views/blog_comments/_reply_form.html.erb +++ b/app/views/blog_comments/_reply_form.html.erb @@ -1,4 +1,6 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> +<% end %>
        • <%= f.text_field :title, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge({ hidden: "hidden"}) %>
          diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index cf24f0f2d..e46a7249f 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor",'blog' %> +<% end %> -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> +<%= import_ke(enable_at: false, prettify: false) %> <%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %> diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 61bbb85d2..e4cf57ae3 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> +<% end %> + <%= error_messages_for 'message' %>
          diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 3fb97bd9d..306a0c7ce 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,4 +1,8 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + + diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index bb3421cba..229419b60 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -1,4 +1,9 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %> + +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= javascript_include_tag 'blog' %> +<% end %> + -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> +
          <% reply_allow = JournalsForMessage.create_by_user? User.current %>

          <%= l(:label_user_response) %>

          diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 669953afa..4f1d3a5d8 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> +
          <% reply_allow = JournalsForMessage.create_by_user? User.current %> diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index b94e33b16..2eef799e7 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,4 +1,8 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor","user" %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= javascript_include_tag "user" %> +<% end %> + <% if params[:show_homepage].nil? %>
          -
          最新动态
          -
            -
          • -
              -
            • -
                -
              • 课程动态
              • -
              • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> -
              • -
              • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> - -
              • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> -
              • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> - - -
              -
            • -
            • -
                -
              • 项目动态
              • -
              • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> -
              • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> - -
              -
            • -
            • -
                -
              • 更多
              • -
              • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> -
              • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> +
                <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
                + <% if params[:org_subfield_id].nil? %> +
                  +
                • +
                    +
                  • +
                      +
                    • 课程动态
                    • +
                    • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> +
                    • +
                    • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> + +
                    • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> +
                    • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> + + +
                    +
                  • +
                  • +
                      +
                    • 项目动态
                    • +
                    • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> +
                    • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> + +
                    +
                  • +
                  • +
                      +
                    • 更多
                    • +
                    • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> +
                    • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> +
                    +
                -
              • -
              + <% end %>
          <% end %> -<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> +<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> diff --git a/public/javascripts/course.js b/public/javascripts/course.js index c61120f21..97e20a5a8 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1363,3 +1363,10 @@ $(function(){ personalized_init(); }); +function submit_course_feedback() { + var flag = false; + if(flag == false){ + $("#course_feedback_new").submit(); + var flag = true + } +} \ No newline at end of file From 01b21ceda16e43d1e17205ded775a2c86b70bb1c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 09:52:17 +0800 Subject: [PATCH 225/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=95=99=E8=A8=80?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_courses_jours.html.erb | 4 ++-- app/views/projects/_project_jours.html.erb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index eee98a0e5..0eaab219d 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -33,7 +33,7 @@

          取消 - 留言 + 留言 <% end %>
          <% end %> @@ -52,7 +52,7 @@ \ No newline at end of file From 9c472b9358c28ee5c1e2697c5fadcd9a4ea5634e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 11:23:02 +0800 Subject: [PATCH 227/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index 6a3090e92..2fe18c4eb 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -6,10 +6,10 @@ <% end %>
          -
          <% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> <% else%> <%= render :partial => 'course_teacher', :locals => {:members => @members} %> <% end%> + From 75fecc040274d7543b4e8bb5549fa930177720dc Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 12:53:01 +0800 Subject: [PATCH 228/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20=E9=A1=B9=E7=9B=AE=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9D=83=E9=99=90=20=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 6 +++++- app/views/courses/_member.html.erb | 2 +- app/views/projects/settings/_new_edit.html.erb | 9 +++++++++ config/locales/zh.yml | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 200bd4d69..88aae0f8b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -697,7 +697,11 @@ class ProjectsController < ApplicationController flash[:error] = l(:error_can_not_archive_project) end end - redirect_to admin_projects_url(:status => params[:status]) + if params[:type] == "project" + redirect_to user_path(User.current) + else + redirect_to admin_projects_url(:status => params[:status]) + end end def unarchive diff --git a/app/views/courses/_member.html.erb b/app/views/courses/_member.html.erb index 7762a0798..1bfe3cbd7 100644 --- a/app/views/courses/_member.html.erb +++ b/app/views/courses/_member.html.erb @@ -1,7 +1,7 @@ <% @members.each do |member| %>
        • <%#= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %> - <%= link_to "#{member.principal}(#{member.principal.show_name})", user_path(member.principal), :class => "w150 c_orange fl" %> + <%= link_to "#{member.principal}(#{member.principal.show_name})", user_path(member.principal), :class => "w150 linkBlue fl" %> <%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %> <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index b38871a60..1d204a52b 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -26,4 +26,13 @@ 保存 <% end %> +<% if User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> +
          + + <%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" }, + :data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %> + <%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> + (友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!) +
          +<% end %>
          diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7ccbb8410..81b20a67e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -921,6 +921,7 @@ zh: button_rollback: 恢复到这个版本 button_reply: 回复 button_archive: 存档 + button_delete_project: 删除项目 button_unarchive: 取消存档 button_reset: 重置 button_rename: 重命名/重定向 From fed989753a73e0dd91060ced4dfa9d2655fed5fe Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 13:46:23 +0800 Subject: [PATCH 229/913] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9E=97=E5=A4=84?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=B8=8D=E8=83=BD=E6=9F=A5=E7=9C=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_forge.html.erb | 4 +++- db/schema.rb | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 94890a368..4e42cd5ae 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -22,6 +22,7 @@ <% end %> <% if ma.forge_message_type == "JoinProject" %> + <% unless ma.project.nil? %>
        • <%= time_tag(ma.created_at).html_safe %>
        • + <% end %> <% end %> - + <% if ma.forge_message_type == "RemoveFromProject" %>
          • diff --git a/db/schema.rb b/db/schema.rb index 9ce76c447..91a9fbb5d 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 => 20151210110210) do +ActiveRecord::Schema.define(:version => 20151209085942) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -459,7 +459,7 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "open_student", :default => 0 t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 - t.integer "is_delete" + t.integer "is_delete", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -970,7 +970,6 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" From f2b8335912c918facd7e47bd11064a8dc704ab80 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 13:48:52 +0800 Subject: [PATCH 230/913] =?UTF-8?q?=E7=A7=BB=E5=87=BA=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=E5=90=8E?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=B3=E8=81=94=E5=88=A0=E9=99=A4=E8=80=8C?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84400=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_forge.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 4e42cd5ae..967941a88 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -57,6 +57,7 @@ <% end %> <% if ma.forge_message_type == "RemoveFromProject" %> + <% unless ma.project.nil? %>
        • <%= time_tag(ma.created_at).html_safe %>
        • + <% end %> <% end %> <% if ma.forge_message_type == "ProjectInvite" %> From f880ccd749c81a99b2c2a23687de47f93522ffad Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 14:57:09 +0800 Subject: [PATCH 231/913] =?UTF-8?q?=E5=88=86=E7=BB=84=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 | 39 +++-- app/controllers/student_work_controller.rb | 144 +++++++++++++++++- app/helpers/application_helper.rb | 28 +++- app/models/homework_common.rb | 2 +- app/models/project.rb | 2 +- app/models/student_work.rb | 2 +- app/models/user.rb | 2 +- .../_choose_group_member.html.erb | 108 +++++++++---- .../student_work/_evaluation_title.html.erb | 8 +- .../_evaluation_un_title.html.erb | 8 +- .../student_work/_evaluation_un_work.html.erb | 24 ++- .../student_work/_evaluation_work.html.erb | 55 ++++--- .../student_work/_relate_project.html.erb | 24 +-- app/views/student_work/_show.html.erb | 32 +++- .../student_work/_student_work_list.html.erb | 7 +- app/views/student_work/new.html.erb | 38 +++-- .../search_course_students.js.erb | 33 ++++ app/views/users/_course_homework.html.erb | 32 ++-- .../users/_user_homework_attachment.html.erb | 20 ++- .../users/_user_homework_detail.html.erb | 28 ++-- config/routes.rb | 1 + lib/tasks/homework_evaluation.rake | 35 ++++- public/images/course/proRelated.png | Bin 0 -> 1249 bytes public/javascripts/course.js | 22 ++- public/javascripts/new_user.js | 22 ++- 25 files changed, 562 insertions(+), 154 deletions(-) create mode 100644 app/views/student_work/search_course_students.js.erb create mode 100644 public/images/course/proRelated.png diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 67499655f..a8d6dfe8f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -126,14 +126,33 @@ class HomeworkCommonController < ApplicationController if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works if student_works && student_works.size >= 2 - student_works.each_with_index do |work, index| - user = work.user - n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 - assigned_homeworks = get_assigned_homeworks(student_works, n, index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) - student_works_evaluation_distributions.save + if @homework.homework_type == 3 + student_work_projects = @homework.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = @homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else + student_works.each_with_index do |work, index| + user = work.user + n = @homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end end end @homework_detail_manual.update_column('comment_status', 2) @@ -143,7 +162,8 @@ class HomeworkCommonController < ApplicationController Mailer.send_mail_anonymous_comment_open(@homework).deliver else @statue = 2 - end + + end else @statue = 3 end @@ -277,6 +297,7 @@ class HomeworkCommonController < ApplicationController @homework = HomeworkCommon.find params[:id] @homework_detail_manual = @homework.homework_detail_manual @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_group = @homework.homework_detail_group @course = @homework.course rescue render_404 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b50f6ea0f..f79646ade 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,7 +3,7 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -95,12 +95,27 @@ class StudentWorkController < ApplicationController @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.where(:id => pro.student_work_id) + else + my_work = @homework.student_works.where(:user_id => User.current.id) + end @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end if my_work.empty? @stundet_works = [] else @@ -116,12 +131,27 @@ class StudentWorkController < ApplicationController @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.where(:id => pro.student_work_id) + else + my_work = @homework.student_works.where(:user_id => User.current.id) + end @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end if my_work.empty? @stundet_works = [] else @@ -190,6 +220,10 @@ class StudentWorkController < ApplicationController student_work.user_id = User.current.id student_work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(student_work) + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + @student_work_project = @homework.student_work_projects.where("user_id = #{User.current.id}").first + student_work.project_id = @student_work_project.project_id + end #提交作品时,计算是否迟交 if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") student_work.late_penalty = @homework.late_penalty @@ -197,6 +231,35 @@ class StudentWorkController < ApplicationController student_work.late_penalty = 0 end if student_work.save + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + @student_work_project.student_work_id = student_work.id + @student_work_project.save + members = params[:group_member_ids].split(',') + for i in 1 .. members.count-1 + stu_project = StudentWorkProject.new + stu_project.homework_common_id = @homework.id + stu_project.student_work_id = student_work.id + stu_project.project_id = @student_work_project.project_id + stu_project.user_id = members[i].to_i + stu_project.is_leader = 0 + stu_project.save + end + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + members = params[:group_member_ids].split(',') + for i in 0 .. members.count-1 + stu_project = StudentWorkProject.new + stu_project.homework_common_id = @homework.id + stu_project.student_work_id = student_work.id + stu_project.project_id = -1 + stu_project.user_id = members[i].to_i + if i == 0 + stu_project.is_leader = 1 + else + stu_project.is_leader = 0 + end + stu_project.save + end + end course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first if course_activity course_activity.updated_at = Time.now @@ -276,6 +339,18 @@ class StudentWorkController < ApplicationController def destroy if @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -288,12 +363,36 @@ class StudentWorkController < ApplicationController @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first if @work @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end end redirect_to user_homeworks_user_path(User.current.id) end def retry_work if @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end @student_work = StudentWork.new respond_to do |format| format.js @@ -555,6 +654,7 @@ class StudentWorkController < ApplicationController @project.homework_common_id = @homework.id @project.project_id = (Project.find params[:projectName].to_i).id @project.user_id = User.current.id + @project.is_leader = 1 if @project.save @user_activity_id = params[:user_activity_id].to_i @is_in_course = params[:is_in_course].to_i @@ -579,6 +679,20 @@ class StudentWorkController < ApplicationController end end + #查找课程的学生 + def search_course_students + name = "" + unless params[:name].nil? + name = params[:name] + end + all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + all_students = User.where("id in #{all_student_ids}") + @users = searchstudent_by_name all_students,name + respond_to do |format| + format.js + end + end + def cancel_relate_project relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first if relate_pro.destroy @@ -592,6 +706,22 @@ class StudentWorkController < ApplicationController end private + def searchstudent_by_name users, name + mems = [] + if name != "" + name = name.to_s.downcase + users.each do |m| + username = m.lastname.to_s.downcase + m.firstname.to_s.downcase + if(m.login.to_s.downcase.include?(name) || m.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name)) + mems << m + end + end + else + mems = users + end + mems + end + def hsd_committed_work?(user, homework) sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first sw.nil? ? result = false : result = true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a19d44997..8f4679c67 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2435,10 +2435,19 @@ module ApplicationHelper link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework + project = cur_user_projects_for_homework homework if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") - link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 + link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品' + else + link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + end elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") - link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' + if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 + link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品' + else + link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' + end else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" @@ -2462,7 +2471,7 @@ module ApplicationHelper def relate_project homework,is_teacher,is_in_course,user_activity_id,course_activity if User.current.member_of_course?(homework.course) if is_teacher - link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + #link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else projects = cur_user_projects_for_homework homework works = cur_user_works_for_homework homework @@ -2471,7 +2480,7 @@ module ApplicationHelper elsif works.nil? link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework.id,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' else - link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + #link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" end end end @@ -2492,7 +2501,16 @@ module ApplicationHelper #获取当前用户在指定作业下提交的作业的集合 def cur_user_works_for_homework homework - homework.student_works.where("user_id = ?",User.current).first + work = homework.student_works.where("user_id = ?",User.current).first + if homework.homework_type == 3 + pro = homework.student_work_projects.where("user_id = #{User.current.id}").first + if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil? + work = nil + else + work = StudentWork.find pro.student_work_id + end + end + work end #获取当前用户在指定作业下关联的项目的集合 def cur_user_projects_for_homework homework diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a665909e2..0ad667bd1 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -10,7 +10,7 @@ class HomeworkCommon < ActiveRecord::Base has_one :homework_detail_manual, :dependent => :destroy has_one :homework_detail_programing, :dependent => :destroy has_one :homework_detail_group, :dependent => :destroy - has_many :student_work_projects + has_many :student_work_projects, :dependent => :destroy has_many :homework_tests, :dependent => :destroy has_many :student_works, :dependent => :destroy, :conditions => "is_test=0" has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 diff --git a/app/models/project.rb b/app/models/project.rb index a80982413..44b9a7912 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -43,7 +43,7 @@ class Project < ActiveRecord::Base end end - has_many :student_work_projects + has_many :student_work_projects,:dependent => :destroy has_many :student_works has_many :time_entry_activities has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}" diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 59b98b9b2..c6e2a6584 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -4,7 +4,7 @@ class StudentWork < ActiveRecord::Base belongs_to :homework_common belongs_to :user - has_one :student_work_project + has_many :student_work_projects has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy belongs_to :project diff --git a/app/models/user.rb b/app/models/user.rb index fa6f005b6..1c5d1b0c8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,7 +107,7 @@ class User < Principal has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy - has_many :student_work_projects + has_many :student_work_projects, :dependent => :destroy #end has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, diff --git a/app/views/student_work/_choose_group_member.html.erb b/app/views/student_work/_choose_group_member.html.erb index 4671dd2a5..1ec8ed0fa 100644 --- a/app/views/student_work/_choose_group_member.html.erb +++ b/app/views/student_work/_choose_group_member.html.erb @@ -9,36 +9,88 @@
          -
            -
          • - 同学一(061530301) -
          • -
          • - 同学二同学二(061530302) -
          • -
          • - 同学三(061530303) -
          • -
          • - 同学四同学四(061530304) -
          • -
          • - 同学五同学五(061530305) -
          • -
          • - 同学六同学六(061530306) -
          • -
          • - 同学七同学七(061530307) -
          • -
          +
            -
              -
            • TimTang(040930319)×
            • -
            • suntao(060930106)×
            • +
                +
              • <%=User.current.show_name %> + <% unless User.current.user_extensions.student_id == "" %> + (<%=User.current.user_extensions.student_id %>) + <% end %> +
              - +
              -
            \ No newline at end of file +
            + \ No newline at end of file diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index cfd9632c2..7398dbee1 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -1,8 +1,12 @@
            • 作品名称 - 姓名 - 学号 + <% if @homework.homework_type != 3 %> + 姓名 + 学号 + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + 关联项目 + <% end %>
            • diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 4ed0a538a..9988bd6e0 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,8 +1,12 @@
              • 作品名称 - 姓名 - 学号 + <% if @homework.homework_type != 3 %> + 姓名 + 学号 + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + 关联项目 + <% end %>
              • diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 2a0962244..641405fe4 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -13,14 +13,22 @@
          • -
              -
            • - <%= student_work.user.show_name%> -
            • -
            • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
            • -
            + <% if @homework.homework_type != 3 %> +
              +
            • + <%= student_work.user.show_name%> +
            • +
            • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
            • +
            + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
              +
            • + <%= student_work.project.name %> +
            • +
            + <% end %>
          • diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index e336b0282..58f611b55 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -1,6 +1,11 @@
              - <% is_my_work = student_work.user == User.current%> + <% if @homework.homework_type != 3 %> + <% is_my_work = student_work.user == User.current%> + <% else %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% is_my_work = pro && pro.student_work_id == student_work.id%> + <% end %>
              • <% if is_my_work%> @@ -14,14 +19,22 @@
          • -
              -
            • - <%= student_work.user.show_name%> -
            • -
            • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
            • -
            + <% if @homework.homework_type != 3 %> +
              +
            • + <%= student_work.user.show_name%> +
            • +
            • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
            • +
            + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
              +
            • + <%= student_work.project.name %> +
            • +
            + <% end %>
          • <% else%>
          • @@ -33,14 +46,22 @@
          • -
              -
            • - 匿名 -
            • -
            • - -- -
            • -
            + <% if @homework.homework_type != 3 %> +
              +
            • + 匿名 +
            • +
            • + -- +
            • +
            + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
              +
            • + 匿名 +
            • +
            + <% end %>
          • <% end%> diff --git a/app/views/student_work/_relate_project.html.erb b/app/views/student_work/_relate_project.html.erb index bcfd9eb8e..43f59c9c9 100644 --- a/app/views/student_work/_relate_project.html.erb +++ b/app/views/student_work/_relate_project.html.erb @@ -7,28 +7,6 @@

              -
              @@ -56,7 +34,7 @@ },500); } - //查询组织 + //查询项目 $("input[name='project']").on('input', function (e) { throttle(search_pros,window,e); }); diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 993b0f2aa..801c252cb 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,5 +1,12 @@
              + <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> + <% if @homework.homework_type != 3 %> + <% is_my_work = work.user == User.current%> + <% else %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% is_my_work = pro && pro.student_work_id == work.id%> + <% end %>
              • 上交时间: @@ -15,7 +22,7 @@ <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
              • <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> + <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
              • <%= render :partial => 'student_work_praise' %> @@ -25,11 +32,24 @@ - <% if work.project%> -
              • - 关联项目: - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> +
                +
              • + 参与人员: + <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> + <% members = work.student_work_projects.where("is_leader = 0") %> + <% members.each do |member| if !members.empty? %> + 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> + <% end %> + <% end %>
              • + <% if @homework.homework_detail_group.base_on_project == 1 %> +
              • + 关联项目: + <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + (综合评分:<%=work.project.project_score.score.to_i %>) +
              • + <% end %> <% end%>
              • @@ -52,7 +72,7 @@
              • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%> + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
                <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index e9b056c84..5598092e9 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -40,12 +40,17 @@ <% end%>
                - <% if student_work.user == User.current && !@is_evaluation %> + <% if @homework.homework_type != 3 && student_work.user == User.current && !@is_evaluation %> <% if @homework.homework_type == 2%> <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% else %> <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% end %> + <% elsif @homework.homework_type == 3 %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% if pro && pro.student_work_id == student_work.id && !@is_evaluation %> + <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% end %> <% end %>
                diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index d14da5fa2..c3a61d4c8 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -54,11 +54,21 @@ function popupRegex(){ if(regexStudentWorkName()&®exStudentWorkDescription()) { - $('#ajax-modal').html("

                作品信息完整性校验中,请稍等...

                "); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $('#ajax-modal').html("

                作品信息完整性校验中,请稍等...

                "); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } + } else { + $('#ajax-modal').html("

                作品信息完整性校验中,请稍等...

                "); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } } } @@ -106,7 +116,11 @@ 提示:作品名称和描述中不要出现真实的姓名信息
                - + <% if @homework.homework_type == 3 %> + + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> + <% end %>
                <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
                @@ -125,12 +139,16 @@
                <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
                +
                +
                +
                +
                - <%# if @homework.homework_type == 3 %> - - <%# end %> +
                + <% end %> + 已关联项目:
              - <% activity.student_work_projects.each do |pro| %> + <% activity.student_work_projects.where("is_leader = 1").each do |pro| %>
              - <% project = Project.find pro.project_id %> + <% project = Project.find pro.project_id || User.current.member_of?(project) || User.current.admin? %> <% if project.is_public || project.user_id == User.current.id %> <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %> <% else %> diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index f1c0ae97e..7aefbd0b0 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -43,7 +43,25 @@ :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> - + +
              + +
              + <% if @homework && @homework.homework_type == 3 %> + + 合作成员:<%=User.current.show_name %>(组长) + + + <% end %> +
              + + <% if @homework %> + <% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %> + <% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %> + 关联项目:<%=project.name %> + <% end %> + <% end %> +
              diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 8e01ee908..57fe57c07 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -49,10 +49,19 @@ 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% end %>
              - <% if homework_common.homework_type == 3%> -
              - <%= relate_project(homework_common,is_teacher,is_in_course,-1,-1) %> -
              + <% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1%> + <% projects = cur_user_projects_for_homework homework_common %> + <% works = cur_user_works_for_homework homework_common %> + <% if works.nil? && projects.nil? %> +
              + <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %> + <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %> +
              + <% elsif works.nil? %> +
              + <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> +
              + <% end %> <% end %>
              <%= user_for_homework_common homework_common,is_teacher %> @@ -90,15 +99,16 @@ <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
              - <% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? %> + <% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
              -
              - +
              + + 已关联项目:
              - <% homework_common.student_work_projects.each do |pro| %> + <% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %>
              <% project = Project.find pro.project_id %> - <% if project.is_public == 1 %> + <% if project.is_public == 1 || User.current.member_of?(project) || User.current.admin? %> <%=link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name) %> <% else %> <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %> diff --git a/config/routes.rb b/config/routes.rb index 2be4f7221..db63fe3ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -221,6 +221,7 @@ RedmineApp::Application.routes.draw do post 'student_work_project' get 'new_student_work_project' get 'search_user_projects' + get 'search_course_students' get 'cancel_relate_project' get 'delete_work' get 'destroy_score_reply' diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 84082eb9b..585d91737 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -14,14 +14,33 @@ namespace :homework_evaluation do if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 student_works = homework_common.student_works if student_works && student_works.size >= 2 - student_works.each_with_index do |work, index| - user = work.user - n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 - assigned_homeworks = get_assigned_homeworks(student_works, n, index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) - student_works_evaluation_distributions.save + if homework_common.homework_type == 3 + student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else + student_works.each_with_index do |work, index| + user = work.user + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end end end homework_detail_manual.update_column('comment_status', 2) diff --git a/public/images/course/proRelated.png b/public/images/course/proRelated.png new file mode 100644 index 0000000000000000000000000000000000000000..2cc1252cc0918a854d382c3bc6aebb1211f2a3b9 GIT binary patch literal 1249 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m<2LJB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`kBtHuNWFoz#!AFNG#Ad)HBe}%?0@jth%@)C>7xhtg4GcDhpEegHnt0 zON)|$@sXws(+mtd{1$-}0$pR}lAm0fo0?bR>0+w{6wyn`OtEq^b#rwzaCEYCb~ZLN zbTxHyb2e~wGIcU?HaB*5bTNkM^~@_SNz6-5h3U;i=yk-a*UGslHL)bWC?r2W2Nrt) z8Tlpo#Toep3eLf13gMY~Df#8apn!$CGqotQEH%ZgC_h&L95Pm!NVYqfIXYT6ni!fG z8CV*cIU1Nd8JnBBS{j==n;1B`8kj3V^`s#AmY^Pepym3YXhe!um=G|nfSB+^3gp0( zd1@XoZ5II(@xN_dJq!$t>7Fi*Ar-gITu)rrtiZ$YVC$ljyZ@iubJjS}+HjYJ@|FvS zGB(L`UCuuU$yrBd9~dkS*MTK1eatgSYG3OtKT^*h>mFd(F1GN 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } + } else { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } } diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index dcd8a35ca..d375a90ee 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -251,8 +251,15 @@ function new_student_work() { if(regexStudentWorkName()&®exStudentWorkDescription()) { - $("#new_student_work").submit(); - $("#ajax-indicator").hide(); + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } + } else { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } } @@ -298,6 +305,17 @@ function regexStudentWorkDescription() } } +function regexStudentWorkMember(min, max) { + var members = $.trim($("#group_member_ids").val()).split(','); + if ( min <= members.length && members.length <= max ){ + $("#student_work_group_textarea").text(""); + return true; + } else { + $("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人"); + return false; + } +} + //学生作品 function show_project() { From c6470bc69b2b9abbb39b32bd4239fd7d24ad506c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 15:31:15 +0800 Subject: [PATCH 232/913] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=88=86=E7=BB=84=E6=88=90=E5=91=98=E6=97=B6?= =?UTF-8?q?=E8=8B=A5=E6=9F=90=E4=B8=80=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=B7=B2?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=B0=E5=85=B6=E4=BB=96=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E5=8F=AF=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/views/student_work/search_course_students.js.erb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f79646ade..86e521b55 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -687,6 +687,7 @@ class StudentWorkController < ApplicationController end all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" all_students = User.where("id in #{all_student_ids}") + @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index fb595e51f..1cea9f27e 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
            • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该学生已加入其它分组"); + } <% end %> <% end %> \ No newline at end of file From 03318aac97d23e101926b693f2dc152e9d419a92 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:36:59 +0800 Subject: [PATCH 233/913] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E4=BF=AE=E6=94=B9=E8=A6=81=E5=8F=98=E6=88=90=E7=81=B0?= =?UTF-8?q?=E8=89=B2?= 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 fa9171496..b95c8f049 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -30,7 +30,7 @@
            •   
              • -
              • <%= f.text_field :login,:no_label=>true, :required => true, :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%>
              • +
              • <%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%>
              • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
              • From b981f3dcea5d203595baf07d4ec1aab38d339588 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 15:39:38 +0800 Subject: [PATCH 234/913] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=A0=E9=99=A4403=E9=97=AE=E9=A2=98=20=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/views/courses/settings.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 88aae0f8b..ab2cfa2ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,7 +30,7 @@ class ProjectsController < ApplicationController before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] - before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] + before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] before_filter :file, :statistics #:watcherlist # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # before_filter :memberAccess, only: :member diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 650127aef..634f26495 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -89,7 +89,7 @@ <% end %>
              <% if @course.is_delete == 1 %> -
              <%=link_to "恢复该课程", renew_course_path(@course) %>
              +
              <%=link_to "恢复该课程", renew_course_path(@course) %>
              <% else %>
              <%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> From d1423ebc7ed268b2d9526093185bd68504d241b3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:41:41 +0800 Subject: [PATCH 235/913] =?UTF-8?q?ke=E9=AB=98=E5=BA=A6=E5=B0=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/init_activity_KindEditor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index 977c62117..a23b83607 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -159,4 +159,5 @@ function init_activity_KindEditor_data(id){ div_form = $("div[nhname='new_message_" + id + "']"); $(".ke-edit", div_form).css("height","33px"); + $(".ke-edit-iframe",div_form).css("height","33px"); } \ No newline at end of file From b178fb7f0a318b1f65dc600c09e74fe4d4b40031 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:56:37 +0800 Subject: [PATCH 236/913] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=20?= =?UTF-8?q?=E7=97=85=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 1ca8f5e1a..9f7b90ee4 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -180,7 +180,7 @@ diff --git a/app/views/organizations/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb index 5b56d57b3..97824bb3a 100644 --- a/app/views/organizations/set_homepage.js.erb +++ b/app/views/organizations/set_homepage.js.erb @@ -1,2 +1,2 @@ //location.reload(); -window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>'; \ No newline at end of file +window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>'; \ No newline at end of file From e5192c7b1a1e8f1539b47474468e9e2c5e04e970 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:02:34 +0800 Subject: [PATCH 242/913] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E6=8F=90=E4=BA=A4=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 +++++ app/models/course_message.rb | 4 ++-- app/views/exercise/_student_exercise.html.erb | 8 -------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 355743dd7..1fe798328 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js @@ -302,6 +305,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save =begin respond_to do |format| format.html { diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 11b0165c5..79d27f3c5 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - # status说明: status在课程不同的类型,区分不同的功能 + # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status @@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base def add_user_message #unless self.course_message_type == 'JoinCourseRequest' - if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9 self.message_alls << MessageAll.new(:user_id => self.user_id) end #end diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3983fb0c4..9c9916e60 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -53,19 +53,11 @@
            • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
            • - <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
              • <%=exercise.user.show_name %> - <%# name = exercise.user.show_name %> - <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <%# else %> - - <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <%# end %>
              • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> From c2d21b5a6bcffa8a3778cb050ed1914c2a2fe25a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 11 Dec 2015 17:11:11 +0800 Subject: [PATCH 243/913] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_left_subfield_list.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index dbeaa6117..367c23843 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,7 +29,8 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%= field.name %> <% end %>
            • - 用户昵称 + 用户登录名 用户身份 diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index aac365a15..6786a06a7 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -31,7 +31,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index a9cb068ad..f97bd8bea 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -109,7 +109,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/courses/_searchmembers.html.erb b/app/views/courses/_searchmembers.html.erb index 1956f34c4..b864bfd8f 100644 --- a/app/views/courses/_searchmembers.html.erb +++ b/app/views/courses/_searchmembers.html.erb @@ -1,5 +1,5 @@ <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生登录名、姓名、学号进行搜索'%> <% if @group %> <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index f62951236..32db48def 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -109,7 +109,7 @@
              <%= form_tag(search_member_course_path,:id => "course_member_search_form", :method => :get, :class => "search_form_course",:remote => true) do %> - <%= text_field_tag 'name', params[:name], :placeholder => "昵称、学号、姓名搜索", :class => "search_text fl" %> + <%= text_field_tag 'name', params[:name], :placeholder => "登录名、学号、姓名搜索", :class => "search_text fl" %> <%= l(:label_search)%> diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index c82a729de..2696bf9ec 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -20,7 +20,7 @@ <%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%> <%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%> <%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%> - + 搜索 diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index e6a84da50..5708f6b3d 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,7 +1,6 @@ <% if @issue_id %> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); -// $("#div_user_issue_detail_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'users/project_issue_detail', :locals => {:issue => Issue.find( @issue_id), :activity => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); issue_desc_editor = KindEditor.create('#issue_description', @@ -18,11 +17,10 @@ "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); - $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> - $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); + $("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 436d571f5..21e611929 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -86,7 +86,7 @@

              添加成员

              <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
              <%= find_user_not_in_current_org_by_name(@project) %> diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb index d82aea7f9..21928492e 100644 --- a/app/views/student_work/_student_work_attachment_form.html.erb +++ b/app/views/student_work/_student_work_attachment_form.html.erb @@ -3,7 +3,7 @@
              - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> + <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> <%= file_field_tag 'attachments[dummy][file]', :id => "_file#{work.id}", :class => 'file_selector', diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index f0dc4f19e..618dc3185 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -65,93 +65,7 @@
              - <% count = activity.journals.count %> -
              -
              -
              回复 - <%= count>0 ? "(#{count})" : "" %> - - <% if activity.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - <% end %> - -
              -
              <%#= format_date(activity.updated_on) %>
              - <% if count > 3 %> - - <% end %> -
              - - <% replies_all_i = 0 %> - <% if count > 0 %> -
              -
                - <% activity.journals.reorder("created_on desc").each do |reply| %> - - <% replies_all_i=replies_all_i + 1 %> -
              • -
                - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> -
                -
                -
                - <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(reply.created_on) %> - - <% if reply.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> - <% end %> - -
                -
                - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -

                <%= string %>

                - <% end %> - <% end %> -

                <%= reply.notes.html_safe %>

                -
                -
                -
                -
              • - <% end %> -
              -
              - <% end %> - -
              -
              <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
              -
              -
              - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f| %> - - -
              - -
              -

              - <% end%> -
              -
              -
              -
              -
              - +
              + <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
              diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb new file mode 100644 index 000000000..0a84ba9c4 --- /dev/null +++ b/app/views/users/_project_issue_reply.html.erb @@ -0,0 +1,89 @@ +<% count = activity.journals.count %> +
              +
              +
              回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
              +
              <%#= format_date(activity.updated_on) %>
              + <% if count > 3 %> + + <% end %> +
              + + <% replies_all_i = 0 %> + <% if count > 0 %> +
              +
                + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
              • +
                + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
                +
                +
                + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> + + <% if reply.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> + <% end %> + +
                +
                + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

                <%= string %>

                + <% end %> + <% end %> +

                <%= reply.notes.html_safe %>

                +
                +
                +
                +
              • + <% end %> +
              +
              + <% end %> + +
              +
              <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
              +
              +
              + <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %> + + +
              + +
              +

              + <% end%> +
              +
              +
              +
              +
              + +
              \ No newline at end of file diff --git a/app/views/welcome/_search_project.html.erb b/app/views/welcome/_search_project.html.erb index 6679f559d..fba855bde 100644 --- a/app/views/welcome/_search_project.html.erb +++ b/app/views/welcome/_search_project.html.erb @@ -91,7 +91,7 @@ form #search_by { if($("#search_type").val() == "users") { - $("#q").attr('placeholder','昵称/姓名/邮箱'); + $("#q").attr('placeholder','登录名/姓名/邮箱'); // $("#search_by").show(); } else diff --git a/config/locales/navigatiors/zh.yml b/config/locales/navigatiors/zh.yml index 97c6da61a..c0df616f3 100644 --- a/config/locales/navigatiors/zh.yml +++ b/config/locales/navigatiors/zh.yml @@ -63,7 +63,7 @@ zh: course: 课程 user: 用户 userinfo: - nickname: 昵称 + nickname: 登录名 showname: 姓名 email: 邮箱 diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 765060675..8bf3f03be 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -369,7 +369,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: 您已成功加入项目! diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d5b249e8d..daa0c3a31 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1855,7 +1855,7 @@ zh: excel_user_id: 学生id excel_user_name: 用户名 - excel_nickname: 昵称 + excel_nickname: 登录名 excel_student_id: 学号 excel_mail: 电子邮箱 excel_homework_name: 作品名 From bb67a8f77de97371d5384d1d4afacf3e6c910e98 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 17:34:35 +0800 Subject: [PATCH 796/913] =?UTF-8?q?=E8=8B=A5=E6=B5=8B=E8=AF=95=E9=9B=86?= =?UTF-8?q?=E5=A4=9F=E9=95=BF=EF=BC=8C=E7=82=B9=E5=87=BB=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=9B=86=EF=BC=8C=E6=AD=A4=E6=97=B6=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E8=87=AA=E5=8A=A8=E5=AE=9A=E4=BD=8D=E5=88=B0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=9B=86=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/homework.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 45721fd1b..0762a6db3 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -194,7 +194,7 @@ $(function(){ autoTextarea2(outputs[i], inputs[i]); } } - + $(inputs[inputs.length - 1]).focus(); }); $("#BluePopupBox").on('click', 'a.icon_remove', function(){ $(this).parent('.mt10').remove(); From 58b5dbdf9aa10eff7d281ff9d83377eda960c2e7 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 18:00:01 +0800 Subject: [PATCH 797/913] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=AD=98=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93=20=E7=B2=BE?= =?UTF-8?q?=E5=93=81=E8=AF=BE=E7=A8=8B=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 8 ++++++++ app/helpers/application_helper.rb | 5 +++++ app/helpers/users_helper.rb | 5 ----- db/migrate/20160122094805_excellent_course.rb | 17 +++++++++++++++++ .../20160122094829_excellent_option_course.rb | 19 +++++++++++++++++++ db/schema.rb | 3 ++- 6 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20160122094805_excellent_course.rb create mode 100644 db/migrate/20160122094829_excellent_option_course.rb diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cafec1c62..707e87fd1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -360,6 +360,9 @@ update end # end @changesets_latest_coimmit = @changesets[0] + unless @changesets[0].blank? + update_commits_date(@project, @changesets_latest_coimmit) + end @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] @@ -589,6 +592,11 @@ update project.project_score.update_attribute(:changeset_num, count) end + # 更新项目提交次数时间 + def update_commits_date project, date + project.project_score.update_attribute(:commit_time, date.created_at) + end + def find_repository @repository = Repository.find(params[:id]) @project = @repository.project diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 51138f2ef..3a0808bdd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,11 @@ module ApplicationHelper end end + def link_to_user_version(version, options = {}) + return '' unless version && version.is_a?(Version) + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + end + # 判断课程是否为精品课程 def is_excellent_course course (course.is_excellent? or course.excellent_option?) ? true : false diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 43ef7cefc..bfc01a102 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -85,11 +85,6 @@ module UsersHelper end end - def link_to_user_version(version, options = {}) - return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " - end - # 统计未读消息数 def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count diff --git a/db/migrate/20160122094805_excellent_course.rb b/db/migrate/20160122094805_excellent_course.rb new file mode 100644 index 000000000..465b81464 --- /dev/null +++ b/db/migrate/20160122094805_excellent_course.rb @@ -0,0 +1,17 @@ +class ExcellentCourse < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122094829_excellent_option_course.rb b/db/migrate/20160122094829_excellent_option_course.rb new file mode 100644 index 000000000..30ee53ba3 --- /dev/null +++ b/db/migrate/20160122094829_excellent_option_course.rb @@ -0,0 +1,19 @@ +class ExcellentOptionCourse < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e6291806..fb021e9ae 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 => 20160122083507) do +ActiveRecord::Schema.define(:version => 20160122094829) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1372,6 +1372,7 @@ ActiveRecord::Schema.define(:version => 20160122083507) do t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 t.integer "attach_num", :default => 0 + t.datetime "commit_time" end create_table "project_statuses", :force => true do |t| From dbed8379d3ab44a4fee491c6e2bde1c0be644966 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 18:10:32 +0800 Subject: [PATCH 798/913] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4e3286700..85fc42f66 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -55,7 +55,7 @@ class OrganizationsController < ApplicationController @organization.name = params[:organization][:name] @organization.description = params[:organization][:description] @organization.is_public = params[:organization][:is_public] - @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 + @organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) From 6ae7da99be343bac8ad87c2823b9bb359a8f7ebb Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 18:33:43 +0800 Subject: [PATCH 799/913] =?UTF-8?q?=E5=B8=96=E5=AD=90=E3=80=81=E5=8D=9A?= =?UTF-8?q?=E5=AE=A2=E3=80=81=E9=80=9A=E7=9F=A5=E3=80=81=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_comments/show.html.erb | 11 +++++++++-- app/views/courses/syllabus.html.erb | 11 +++++++++-- app/views/memos/show.html.erb | 11 +++++++++-- app/views/messages/_course_show.html.erb | 11 +++++++++-- app/views/messages/_org_subfield_show.html.erb | 11 +++++++++-- app/views/messages/_project_show.html.erb | 9 ++++++++- app/views/news/_course_show.html.erb | 9 ++++++++- app/views/news/_organization_show.html.erb | 9 ++++++++- app/views/news/_project_show.html.erb | 9 ++++++++- app/views/organizations/_show_org_document.html.erb | 11 +++++------ app/views/users/_project_news.html.erb | 3 --- 11 files changed, 82 insertions(+), 23 deletions(-) diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 6f4397569..93041e1be 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -94,7 +94,7 @@
              <%= format_time( @article.created_on)%>
              -
              +
              <%= @article.content.html_safe%>
              @@ -208,4 +208,11 @@
              <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index 9d20b5adb..c9d333e6d 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -94,7 +94,7 @@
              <%= format_time( @article.created_on)%>
              -
              +
              <%= @article.content.html_safe%>
              @@ -214,4 +214,11 @@
              <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index b7cc1a0c2..3028f3369 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -74,7 +74,7 @@ <%= link_to @memo.author.name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%>
              <%= format_date( @memo.created_at)%>
              -
              +
              <%= @memo.content.html_safe%>
              @@ -136,4 +136,11 @@
              - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index c760e686d..66d4bd0d0 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -80,7 +80,7 @@
              <%= format_time( @topic.created_on)%>
              -
              +
              <%= @topic.content.html_safe%>
              @@ -168,4 +168,11 @@
              <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 6d12fe960..f46e7d5ab 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -109,7 +109,7 @@
              <%= format_time( @topic.created_on)%>
              -
              +
              <%= @topic.content.html_safe%>
              @@ -197,4 +197,11 @@
              <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index c98f2983e..187e1670e 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -135,7 +135,7 @@
              <%= format_time( @topic.created_on)%>
              -
              +
              <%= @topic.content.html_safe%>
              @@ -225,3 +225,10 @@
              + diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 767c11553..05a430d57 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -85,7 +85,7 @@
              <%= format_time( @news.created_on)%>
              -
              +
              <%= @news.description.html_safe%>
              @@ -182,3 +182,10 @@ <% end %>
              + diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index 3e608c177..3189b03bf 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -75,7 +75,7 @@
              <%= format_time( @news.created_on)%>
              -
              +
              <%= @news.description.html_safe%>
              @@ -172,3 +172,10 @@ <% end %>
              + diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 880bd0885..93fd1f10c 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -85,7 +85,7 @@
              <%= format_time( @news.created_on)%>
              -
              +
              <%= @news.description.html_safe%>
              @@ -182,3 +182,10 @@ <% end %>
              + diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index d4b44a3d2..b29bac7d1 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -20,10 +20,12 @@
              <% unless document.content.blank? %> -
              - <%= document.content.html_safe %> -
              + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>document.id, :content=>document.content} %> <% end %> +
              + + +
              <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
              @@ -133,9 +135,6 @@ From 26f850067125f4302c0c2cdf5a1bd794129bc61e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 18:42:50 +0800 Subject: [PATCH 800/913] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=AF=A5=E5=8D=9A=E5=AE=A2=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4=E4=B8=BA=E5=BD=93=E5=89=8D=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 1 + app/models/blog_comment.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index df6ba10d2..87bbcb2f3 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -127,6 +127,7 @@ class BlogCommentsController < ApplicationController @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment @article.save + # @article.update_attribute(:updated_on, @blogComment.updated_on) @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index db28e55d6..2b31af604 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity after_update :update_activity + after_create :update_parent_time before_destroy :destroy_user_activity scope :like, lambda {|arg| @@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base (user && user.logged? && (self.author == user) ) || user.admin? end + def update_parent_time + if !self.parent.nil? + self.root.update_attribute(:updated_on, self.updated_on) + end + end def project end end From 16cb4add09365267eb0eefebd59fd9b5ae287e4e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 18:48:40 +0800 Subject: [PATCH 801/913] =?UTF-8?q?issue=E5=B1=80=E9=83=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=B1=9E=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/issues_controller.rb | 4 ++-- app/views/users/_project_issue.html.erb | 2 ++ app/views/users/_project_issue_detail.html.erb | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 72dd0a741..eb78c4c5b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,7 +81,7 @@ class IssuesController < ApplicationController @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] - @done_ratio = parmas[:done_ratio] + @done_ratio = params[:done_ratio] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @@ -222,7 +222,7 @@ class IssuesController < ApplicationController def update if params[:issue_detail] - issue = Issue.find(params[:issue_id]) + issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) @saved = update_user_issue_detail(issue, params) return diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 618dc3185..725a064cc 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,9 +52,11 @@ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> + <% unless params[:action] == "index" %>
              <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
              + <% end %>
              diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index e46761bd1..b682a74ea 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -42,7 +42,7 @@ {:include_blank => false, :selected => @status_id ? @status_id : 0 }, {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> <%# end %> - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
            •  状态  : 

              <%= activity.status.name %>

              @@ -54,7 +54,7 @@
            • <% end %>
              - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
            •  指派  : 

              @@ -68,7 +68,7 @@
                - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
              •  优先级  : 

                <%= activity.priority.name %> @@ -78,7 +78,7 @@
              • <% end %>
                - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
              •  完成度  : 

                <%= activity.done_ratio %>% From c4a264f8a6864f5487d7d63945b3fa11dd7ddd98 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 18:48:50 +0800 Subject: [PATCH 802/913] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_work_edit_information.html.erb | 10 +++++++++- app/views/student_work/_work_information.html.erb | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/views/student_work/_work_edit_information.html.erb b/app/views/student_work/_work_edit_information.html.erb index 38670d9e4..1934d15eb 100644 --- a/app/views/student_work/_work_edit_information.html.erb +++ b/app/views/student_work/_work_edit_information.html.erb @@ -13,7 +13,15 @@ <%= "无附件"%> <% else %>
                - <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> + <% @student_work.attachments.each_with_index do |attachment,i| %> +
                + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %> + (<%= number_to_human_size attachment.filesize %>) +
                +
                + <% end -%> + <%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
                <% end %>

                diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index bc728ca71..d23f21c4d 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -13,7 +13,15 @@ <%= "无附件"%> <% else %>
                - <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> + <% @student_work.attachments.each_with_index do |attachment,i| %> +
                + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %> + (<%= number_to_human_size attachment.filesize %>) +
                +
                + <% end -%> + <%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
                <% end %>

                From 007afa8c4f991471d7f6bd84f80bb78fc4c54f29 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 19:34:02 +0800 Subject: [PATCH 803/913] =?UTF-8?q?issue=E5=9C=A8=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=E5=9B=9E=E5=A4=8D=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/issues/add_journal.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 5708f6b3d..9099c31b6 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -20,7 +20,7 @@ $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> - $("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); + $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> From afad062b809ee80c7592973a0274e508b854a715 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 19:49:05 +0800 Subject: [PATCH 804/913] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E3=80=81=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E7=9A=84title,?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BAFiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_file.html.erb | 2 +- app/views/files/_project_file.html.erb | 2 +- app/views/files/_subfield_files.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 85b230be3..cf91b7814 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -126,4 +126,4 @@ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 88c30e1b7..e8f4f023b 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -95,4 +95,4 @@ <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index eed9266d5..1de0e8dc2 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -74,7 +74,7 @@ -<% html_title(l(:label_attachment_plural)) -%> +<%# html_title(l(:label_attachment_plural)) -%> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>false} %> <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> <% end %> <%end%> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index ac56b69fc..8d6674845 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,9 +1,9 @@ <% if @save_succ %> <% if @user_activity_id %> <% if @reply_type == 'user' %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); <% else %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); <% end %> init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); <% else %> From 655cc0d2dbcaadaf95ed4dbe56d2a2bdf07a90bb Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 20:26:44 +0800 Subject: [PATCH 807/913] =?UTF-8?q?issue=E6=88=AA=E6=AD=A2=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 10 +++++++++- app/views/mailer/issue_due_date.text.erb | 0 lib/tasks/issue_due_date.rake | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 app/views/mailer/issue_due_date.text.erb diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ee37927d3..05b0349ec 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -380,7 +380,15 @@ class Mailer < ActionMailer::Base end # issue截止时间提醒 - def issue_due_date(issue, recipients) + def issue_due_date(issue) + recipients ||= [] + if issue.author.id != issue.assigned_to_id + recipients << issue.author.mail + end + + # 被指派人邮箱地址加入数组 + recipients << issue.assigned_to.mail + # cc = wiki_content.page.wiki.watcher_recipients - recipients @author = issue.author @issue_name = issue.subject @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) diff --git a/app/views/mailer/issue_due_date.text.erb b/app/views/mailer/issue_due_date.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index 74ee242f5..8ea6d9ed0 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -14,10 +14,10 @@ namespace :issue_due_date do recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) - # issue截止时间邮件提醒 - Mailer.issue_due_date(issue, recipients).deliver end end + # issue截止时间邮件提醒 + Mailer.issue_due_date(issue).deliver end end end From b3caa0154057d053d24924a84de988a1f55c689a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 20:45:25 +0800 Subject: [PATCH 808/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_recommendation.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index 455ced056..d0afc6ebd 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -7,7 +7,7 @@

                <%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %>

                <%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>) - <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(e_course), :class => "linkBlue2" %>)

                + <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)

              • From bbdced9bc11b04ef06143675c3a400a4429fb9ea Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 21:41:17 +0800 Subject: [PATCH 809/913] =?UTF-8?q?=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_jour_form.html.erb | 4 ++-- app/views/users/_user_activities.html.erb | 2 +- app/views/users/_user_journalsformessage.html.erb | 2 +- app/views/users/_user_jours_list.html.erb | 2 +- app/views/words/create_reply.js.erb | 2 +- db/schema.rb | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb index 13bf6d79a..4ad9fef54 100644 --- a/app/views/users/_jour_form.html.erb +++ b/app/views/users/_jour_form.html.erb @@ -8,8 +8,8 @@ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= f.kindeditor :content, :editor_id => 'jour_content_editor', :width => '99.7%', - :height => 40, - :minHeight=>40, + :height => 100, + :minHeight=>100, :input_html => { :id => 'jour_content', :class => 'talk_text fl', :maxlength => 5000 }%> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index d4169bc47..c8d599af4 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -111,7 +111,7 @@ <% case user_activity.act_type.to_s %> <% when 'JournalsForMessage' %> <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>true} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %> <% end %> <% end %> <% end %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index 70cce2374..e30fd1824 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -16,7 +16,7 @@ <% end %> <% end %> - <% if is_activity %> + <% if is_activity.to_i == 1 %>
                <% if activity.parent %> <%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %> diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb index 6993a7e91..c73344a7a 100644 --- a/app/views/users/_user_jours_list.html.erb +++ b/app/views/users/_user_jours_list.html.erb @@ -22,7 +22,7 @@ init_activity_KindEditor_data(<%= jour.id%>, null, "87%", "<%=jour.class.to_s%>"); }); - <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>false} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>0} %> <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> <% end %> <%end%> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index 8d6674845..d4d9a2cd7 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -3,7 +3,7 @@ <% if @reply_type == 'user' %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); <% else %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); <% end %> init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); <% else %> diff --git a/db/schema.rb b/db/schema.rb index fb021e9ae..b31ebc5c2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1371,6 +1371,7 @@ ActiveRecord::Schema.define(:version => 20160122094829) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 + t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From 4b253835313fd02367d4394d373bf24153beb03b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 21:42:05 +0800 Subject: [PATCH 810/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84tip=E8=A2=AB=E9=81=AE=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 2 +- public/stylesheets/project.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 1e3c68c83..a0052b97a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -513,7 +513,7 @@ a.exit { height:24px; display:block; width:80px; color:#000000; background:#c3c3 .st_list{ width:670px;} .st_search{ } .st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} -.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;} +.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;} .st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; } .st_search a:hover{ background:#048fbb; text-decoration:none;} .classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f1b0c5846..29c099d3d 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -414,7 +414,7 @@ a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !impor .st_list{ width:670px;} .st_search{ } .st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} -.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;} +.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;} .st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; } .st_search a:hover{ background:#048fbb; text-decoration:none;} .classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} @@ -1167,4 +1167,4 @@ div.disable_link {background-color: #c1c1c1 !important;} /*问题跟踪局部修改属性*/ .proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} -.proInfoBox2 ul li{ height:24px; position:relative;} +.proInfoBox2 ul li{ height:24px; position:relative;} From 435f81a42203969edf90807e9d0bb6cb148457e3 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 21:47:59 +0800 Subject: [PATCH 811/913] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_course_homework.html.erb | 2 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 3446a86d4..3dccdcc2b 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -194,7 +194,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

                <%=(User.find project.user_id).show_name %>(组长)

                -

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                +

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                项目名称:<%=project.name %>
                创建者:<%=(User.find project.user_id).show_name %>(组长)
                diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 5be1334c3..23a469188 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -193,7 +193,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

                <%=(User.find project.user_id).show_name %>(组长)

                -

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                +

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                项目名称:<%=project.name %>
                创建者:<%=(User.find project.user_id).show_name %>(组长)
                diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 04c8b8f0a..36b2be34f 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -195,7 +195,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

                <%=(User.find project.user_id).show_name %>(组长)

                -

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                +

                <%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>  <%= project.project_score.changeset_num %>提交

                项目名称:<%=project.name %>
                创建者:<%=(User.find project.user_id).show_name %>(组长)
                From 83ff449946ed50209a466b2430cd3579dfe40287 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 21:51:31 +0800 Subject: [PATCH 812/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=B5=84=E6=BA=90=20=E6=B5=8F=E8=A7=88=20=E6=94=B9?= =?UTF-8?q?=E6=88=90=20=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index daa0c3a31..e9d3ed813 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -674,7 +674,7 @@ zh: label_day_plural: 天 label_repository: 版本库 label_course_repository: 代码库 - label_browse: 浏览 + label_browse: 上传文件 label_branch: 分支 label_tag: 标签 label_revision: 修订 From 8f1bffd28b6dc9e02fbc57521e3bedfcff778849 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 21:53:32 +0800 Subject: [PATCH 813/913] =?UTF-8?q?=E7=95=99=E8=A8=80=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/new_user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index f273f0b77..b6301afad 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -75,7 +75,7 @@ function private_jour_submit(){ function jourReplyVerify() { var content = jour_content_editor.html();//$.trim($("#message_content").val()); if (jour_content_editor.isEmpty()) { - $("#jour_content_span").text("回复不能为空"); + $("#jour_content_span").text("留言不能为空"); $("#jour_content_span").css('color', '#ff0000'); $("#submit_feedback_user").one('click',function() { jour_submit(); From f632a3d4fb7b69883a9272848c3481b158bb7c08 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 22:17:52 +0800 Subject: [PATCH 814/913] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/homework.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 0762a6db3..bd2b967e4 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -117,6 +117,7 @@ $(function(){ $('#BluePopupBox').parent().resizable("disable"); $('#BluePopupBox').parent().removeClass("ui-state-disabled"); $('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); + $('#BluePopupBox').parent().css("position","fixed"); $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); From dfb8a3afbf1eeca98b38b0d91746a417015120ac Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 22:35:47 +0800 Subject: [PATCH 815/913] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160122142844_excellent_course_se.rb | 17 +++++++++++++++++ .../20160122143138_excellent_option_se.rb | 19 +++++++++++++++++++ db/schema.rb | 3 +-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160122142844_excellent_course_se.rb create mode 100644 db/migrate/20160122143138_excellent_option_se.rb diff --git a/db/migrate/20160122142844_excellent_course_se.rb b/db/migrate/20160122142844_excellent_course_se.rb new file mode 100644 index 000000000..c6f5dbb88 --- /dev/null +++ b/db/migrate/20160122142844_excellent_course_se.rb @@ -0,0 +1,17 @@ +class ExcellentCourseSe < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122143138_excellent_option_se.rb b/db/migrate/20160122143138_excellent_option_se.rb new file mode 100644 index 000000000..cee739b7f --- /dev/null +++ b/db/migrate/20160122143138_excellent_option_se.rb @@ -0,0 +1,19 @@ +class ExcellentOptionSe < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index b31ebc5c2..b2c74a96c 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 => 20160122094829) do +ActiveRecord::Schema.define(:version => 20160122143138) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1371,7 +1371,6 @@ ActiveRecord::Schema.define(:version => 20160122094829) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 - t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From d386b2ff84194f4f5a22bc03a3d5ad5ad38e390b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Jan 2016 22:37:47 +0800 Subject: [PATCH 816/913] =?UTF-8?q?=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E2=80=9C=E5=B1=95=E5=BC=80=E6=9B=B4=E5=A4=9A=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_jours_list.html.erb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb index c73344a7a..d982d8984 100644 --- a/app/views/users/_user_jours_list.html.erb +++ b/app/views/users/_user_jours_list.html.erb @@ -18,6 +18,22 @@ <% jours.each do |jour|%> <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> -
                -
                -
                  - <%#= labelled_fields_for :issue, @issue do |f| %> - <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), - {:include_blank => false, :selected => @status_id ? @status_id : 0 }, - {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> - <%# end %> - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> -
                • -

                   状态  : 

                  -

                  <%= activity.status.name %>

                  - <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - {:include_blank => false, :selected => @status_id ? @status_id : 0 }, - {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} - ) - %> -
                • - <% end %> -
                  - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> -
                • -

                   指派  : 

                  - - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> - - <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), - { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, - {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> -
                • - <% end %> -
                  -
                -
                  - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> -
                • -

                   优先级  : 

                  - <%= activity.priority.name %> - <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, - {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> -
                • - <% end %> -
                  - <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> -
                • -

                   完成度  : 

                  - <%= activity.done_ratio %>% - <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, - {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> - <% end %> -
                • - -
                  -
                -
                  -
                • -

                   开始  : 

                  -

                  <%= format_date(activity.start_date) %>

                  -
                • -
                  -
                • -

                   周期  : 

                  - <%= l_hours(activity.estimated_hours) %>
                • -
                  -
                -
                  -
                • -

                   计划完成  : 

                  - <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
                • -
                  -
                • -

                   目标版本  : 

                  - <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
                • -
                  -
                - + +
                +
                +
                  + <%#= labelled_fields_for :issue, @issue do |f| %> + <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> + <%# end %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> +
                • +

                   状态  : 

                  +

                  <%= activity.status.name %>

                  + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + {:include_blank => false, :selected => @status_id ? @status_id : 0 }, + {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit",:style=>"white-space:nowrap; overflow:hidden;"} + ) + %> +
                • + <% end %> +
                  + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> +
                • +

                   指派  : 

                  + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> + + <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), + { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> +
                • + <% end %> +
                  +
                +
                  + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> +
                • +

                   优先级  : 

                  + <%= activity.priority.name %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + {:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, + {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> +
                • + <% end %> +
                  + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> +
                • +

                   完成度  : 

                  + <%= activity.done_ratio %>% + <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), + {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, + {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> + <% end %> +
                • + +
                  +
                +
                  +
                • +

                   开始  : 

                  +

                  <%= format_date(activity.start_date) %>

                  +
                • +
                  +
                • +

                   周期  : 

                  + <%= l_hours(activity.estimated_hours) %>
                • +
                  +
                +
                  +
                • +

                   计划完成  : 

                  + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
                • +
                  +
                • +

                   目标版本  : 

                  + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
                • +
                  +
                +
                \ No newline at end of file From 1607508887a35bd7f69db590bf4f9826f34981c2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 25 Jan 2016 14:19:39 +0800 Subject: [PATCH 822/913] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B0=86=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E5=8F=91=E9=80=81=E8=87=B3=E8=AF=BE=E7=A8=8B=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/controllers/users_controller.rb | 59 +++++++++++++++---- app/views/files/index.html.erb | 14 ----- app/views/messages/_course_show.html.erb | 2 +- .../messages/_org_subfield_show.html.erb | 1 + app/views/messages/_project_show.html.erb | 2 +- app/views/org_subfields/show.html.erb | 14 ----- .../_org_subfield_message.html.erb | 1 - app/views/users/_course_message.html.erb | 4 +- app/views/users/_project_message.html.erb | 4 +- .../users/_share_message_to_course.html.erb | 56 ++++++++++++++++++ .../users/_share_message_to_org.html.erb | 59 +++++++++++++++++++ .../users/_share_message_to_project.html.erb | 53 +++++++++++++++++ app/views/users/search_user_course.js.erb | 4 +- app/views/users/search_user_org.js.erb | 4 +- app/views/users/search_user_project.js.erb | 4 +- .../users/share_message_to_course.js.erb | 2 + app/views/users/share_message_to_org.js.erb | 2 + .../users/share_message_to_project.js.erb | 2 + config/routes.rb | 3 + 20 files changed, 240 insertions(+), 52 deletions(-) create mode 100644 app/views/users/_share_message_to_course.html.erb create mode 100644 app/views/users/_share_message_to_org.html.erb create mode 100644 app/views/users/_share_message_to_project.html.erb create mode 100644 app/views/users/share_message_to_course.js.erb create mode 100644 app/views/users/share_message_to_org.js.erb create mode 100644 app/views/users/share_message_to_project.js.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4e3286700..514903e93 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -302,7 +302,7 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @subfield = @org.org_subfields.where("field_type = 'Post'") else @subfield = @org.org_subfields.where('field_type = "Resource" ') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 38d148907..84f7d44c4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1791,16 +1791,6 @@ class UsersController < ApplicationController def share_news_to_project news = News.find(params[:send_id]) project_ids = params[:project_ids] - # project_ids.each do |project_id| - # if Project.find(project_id).news.map(&:id).exclude?(news.id) - # project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) - # news.attachments.each do |attach| - # project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, - # :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, - # :is_public => attach.is_public, :quotes => 0) - # end - # end - # end project_ids.each do |project_id| project = Project.find(project_id) if project.news.map(&:id).exclude?(news.id) @@ -1826,6 +1816,53 @@ class UsersController < ApplicationController OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) end + def share_message_to_course + @message = Message.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + course = Course.find(course_id) + if course.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_project + @message = Message.find(params[:send_id]) + project_ids = params[:project_ids] + project_ids.each do |project_id| + project = Project.find(project_id) + if project.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_org + field_id = params[:subfield] + @message = Message.find(params[:send_id]) + @message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1) + @message.save + board = OrgSubfield.find(field_id).boards.first + mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id) + end + def change_org_subfield end @@ -2175,7 +2212,7 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} else @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8cb547b13..d4d12232e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -185,20 +185,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index c3278a209..ce2f6e085 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -60,7 +60,7 @@ ) if @message.course_destroyable_by?(User.current) %> <% end %> -
              • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
              • +
              • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
            • diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 304694b39..2578b2101 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -89,6 +89,7 @@ :class => 'postOptionLink' ) if @message.org_subfield_editable_by?(User.current) %> +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');",:class => 'postOptionLink'%>
            • diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index e5aba7c02..25fbc841b 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -115,7 +115,7 @@ ) if @message.destroyable_by?(User.current) %> <% end %> -
            • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
            • +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
            • diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 82203b4de..7d3a2b969 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -178,20 +178,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 349f7c86e..16a2a55d6 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -13,7 +13,6 @@ <% end %> TO <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> -
              <% if activity.parent_id.nil? %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 5abd08224..8a7c6d4cd 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -71,9 +71,7 @@ ) if activity.course_destroyable_by?(User.current) %> <% end %> -
            • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
            • +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
            • diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d4a7a9e60..ec36854cb 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -71,9 +71,7 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
            • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
            • +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
            • diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb new file mode 100644 index 000000000..eda4a9b97 --- /dev/null +++ b/app/views/users/_share_message_to_course.html.erb @@ -0,0 +1,56 @@ + + +
              +
              +
              发送到
              +
              + +
              +
              +
              + +
              + <%= 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) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
              + <%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
              + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
              + <% if !courses.empty? %> + <% courses.each do |course| %> +
                +
              • + +
              • +
              • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
              • +
              + <% end %> +
              +
              +
              +
              + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
              + +
              +
              + <% end %> +
              + diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb new file mode 100644 index 000000000..da3c7a072 --- /dev/null +++ b/app/views/users/_share_message_to_org.html.erb @@ -0,0 +1,59 @@ +
              +
              发送到
              +
              + +
              + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
              +
              +<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
              + +
                + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
              • + +
              • + <%end%> + <%end%> +
              +
              +
              +
                + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
              +
              +
              +
              目标地址:
              +
              + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
              +
              + 取消 +
              +
              +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb new file mode 100644 index 000000000..4b79a779c --- /dev/null +++ b/app/views/users/_share_message_to_project.html.erb @@ -0,0 +1,53 @@ +
              +
              +
              发送到
              +
              + +
              +
              +
              + +
              + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
              + <%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
              + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
              + <% if !projects.empty? %> + <% projects.each do |project| %> +
                +
              • + +
              • +
              • <%= project.name%>
              • +
              + <% end %> +
              +
              +
              +
              + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
              + +
              +
              + <% end %> +
              + diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 138eab6f9..eed7499d5 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -11,8 +11,10 @@ //$("#upload_box").css('display','block'); <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index fb6efec9a..877629e34 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,7 +1,9 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 926b7aa58..f80be34f8 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,7 +1,9 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/users/share_message_to_course.js.erb b/app/views/users/share_message_to_course.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_course.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_org.js.erb b/app/views/users/share_message_to_org.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_org.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_project.js.erb b/app/views/users/share_message_to_project.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_project.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3a4d2fb92..4f191a9bf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -541,6 +541,9 @@ RedmineApp::Application.routes.draw do post 'share_news_to_course' post 'share_news_to_project' post 'share_news_to_org' + post 'share_message_to_course' + post 'share_message_to_project' + post 'share_message_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' From b6e13340e56a09dfd4060760df1b744379466645 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 15:33:50 +0800 Subject: [PATCH 823/913] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= =?UTF-8?q?=E7=9A=84=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/controllers/words_controller.rb | 4 ++- .../users/_user_journalsformessage.html.erb | 27 +++++++++++++++++-- app/views/words/create_reply.js.erb | 6 +---- app/views/words/destroy.js.erb | 12 ++++++--- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index d24427a9d..699a5e8ca 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -73,7 +73,6 @@ class WordsController < ApplicationController # render 'test/index' # } format.js { - @reply_type = params[:reply_type] @user_activity_id = params[:user_activity_id] @activity = JournalsForMessage.find(parent_id) @is_activity = params[:is_activity] @@ -95,6 +94,9 @@ class WordsController < ApplicationController @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @is_user = true + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_activity = params[:is_activity].to_i if params[:is_activity] + @activity = @journal_destroyed.parent if @journal_destroyed.parent elsif @journal_destroyed.jour_type == 'HomeworkCommon' @homework = HomeworkCommon.find @journal_destroyed.jour_id if params[:user_activity_id] diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index e30fd1824..d7247621a 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -39,6 +39,22 @@ 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
              + <% if activity.user == User.current || User.current.admin?%> +
              +
                +
              • +
                  +
                • + <%= link_to(l(:label_bid_respond_delete), + {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', + :class => "postOptionLink", :title => l(:button_delete)) %> +
                • +
                +
              • +
              +
              + <% end%>
              @@ -71,7 +87,7 @@
                <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> <% replies_all_i = replies_all_i + 1 %> -
              • +
              • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
                @@ -90,6 +106,14 @@ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% end %> +
                <%= comment.notes.html_safe %> @@ -112,7 +136,6 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> - <%= hidden_field_tag 'reply_type',params[:reply_type],:value =>'user' %> <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
                diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d4d9a2cd7..d9e00a112 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,10 +1,6 @@ <% if @save_succ %> <% if @user_activity_id %> - <% if @reply_type == 'user' %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); - <% else %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); - <% end %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 6a56249a3..6d0055718 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,13 +2,19 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - var destroyedItem = $('#<%=@journal_destroyed.id%>'); + <% if @activity %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); + init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").hide(); + <% end %> + /*var destroyedItem = $('#<%#=@journal_destroyed.id%>'); destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); - <% if @jours_count && @jours_count == 0 %> + <%# if @jours_count && @jours_count == 0 %> $("#user_jour_list").css("padding","0px"); - <% end %> + <%# end %>*/ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); From 184e0ee6898bd1a034f93cf711acc926eb6d8e93 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 16:50:34 +0800 Subject: [PATCH 824/913] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E3=80=81=E8=AF=BE=E7=A8=8B=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E3=80=81=E4=BD=9C=E4=B8=9A=E4=B8=AA=E6=95=B0=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 + lib/redmine/menu_manager.rb | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 68386de44..c7b4dc615 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,6 +29,7 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? + @lastest_login_user_count = User.all.count end def projects diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index a2d2214b6..f9ce21987 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -1,3 +1,4 @@ +#coding=utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -180,8 +181,20 @@ module Redmine end def render_single_menu_node(item, caption, url, selected) - - link_to(h(caption), url, item.html_options(:selected => selected)) + title = h(caption) + case title + when '作业' + title = h(caption) + "(#{HomeworkCommon.all.count})" + when '组织列表' + title = h(caption) + "(#{Organization.all.count})" + when '项目列表' + title = h(caption) + "(#{Project.all.count})" + when '课程列表' + title = h(caption) + "(#{Course.all.count})" + when '用户列表' + title = h(caption) + "(#{User.all.count})" + end + link_to(title, url, item.html_options(:selected => selected)) end From 945d0a933f527337764393a6f0959071dffa1dfa Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jan 2016 17:34:04 +0800 Subject: [PATCH 825/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=B8=BA=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 1 - app/controllers/users_controller.rb | 6 ++++++ db/schema.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c7b4dc615..68386de44 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,7 +29,6 @@ class AdminController < ApplicationController def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? - @lastest_login_user_count = User.all.count end def projects diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b155e9f90..8794808a3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1633,6 +1633,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end elsif params[:send_ids].present? @@ -1668,6 +1671,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end end diff --git a/db/schema.rb b/db/schema.rb index b2c74a96c..8af34d878 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1371,6 +1371,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 + t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end From dda64245b3056c3b2e823f7b9295bb89b068ad30 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 10:35:54 +0800 Subject: [PATCH 826/913] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A1.=E7=BC=96=E8=BE=91=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=A6=96=E9=A1=B5=E5=90=8E=EF=BC=8C=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E8=87=B3=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81=EF=BC=9B2.?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=90=8D=E7=89=87=E4=B8=AD=EF=BC=8C=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E6=98=BE=E7=A4=BA=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=9B3.=E5=90=8C=E6=84=8F=E7=94=B3=E8=AF=B7=E5=AD=90?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=B7=B2?= =?UTF-8?q?=E5=90=8C=E6=84=8F=E7=94=B3=E8=AF=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 4 ++-- app/views/users/_show_detail_info.html.erb | 9 +++++++-- app/views/users/_user_message_org.html.erb | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index df6ba10d2..055236302 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -55,8 +55,8 @@ class BlogCommentsController < ApplicationController if params[:in_act] redirect_to user_path(params[:user_id]) else - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id) + redirect_to user_path(params[:user_id]) else redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) end diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index dc6599884..9de431336 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -6,11 +6,16 @@
                - + <% if (user.user_extensions && (user.user_extensions.identity != 2) ) %> + + <% end %> +

                - <%= user.user_extensions.technical_title %> + <% if user.user_extensions && user.user_extensions.identity %> + <%= get_user_roll(user) %> + <% end %>

                diff --git a/app/views/users/_user_message_org.html.erb b/app/views/users/_user_message_org.html.erb index 5bf1c8950..e3b656a46 100644 --- a/app/views/users/_user_message_org.html.erb +++ b/app/views/users/_user_message_org.html.erb @@ -12,7 +12,7 @@ <%= ma.content %>
              • - <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"已同意申请", + <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ), :id => "agree_apply_subdomain_#{ma.id}", :method => 'post', From 63d1d3a8e7c1ff91f59cb9a592a07e18b82f187f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 10:59:28 +0800 Subject: [PATCH 827/913] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=8F=AA=E8=A6=81=E6=98=AF=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=B0=B1=E6=98=BE=E7=A4=BA=E7=BC=96=E8=BE=91?= =?UTF-8?q?issue=E5=A4=9A=E5=B1=9E=E6=80=A7=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 1e9f1bb68..c5d93e0a5 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,7 +52,7 @@ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> - <% if is_project_manager?(User.current, activity.project) %> + <% if User.current.member_of?(activity.project) %> <% unless params[:action] == "index" %>
                <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> From 821ade7985401ba8dc43cb40d2b74b5612e02654 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 26 Jan 2016 11:00:24 +0800 Subject: [PATCH 828/913] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_project_info.html.erb | 4 +- .../_programing_work_show.html.erb | 279 +++++++++--------- app/views/student_work/_show.html.erb | 277 ++++++++--------- .../_work_attachments_status.html.erb | 2 +- 4 files changed, 282 insertions(+), 280 deletions(-) diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 60fc6f96d..98670dba0 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -9,13 +9,13 @@ <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
                -
                <%= @course.is_public == 0 ? "私有课程" : "公开课程" %> +
                ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %> <% if @course.id == 370 %> 精品课程 <% end %>
                -ID:<%= @course.id%> +加入课程
                -
              • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
              • -
              • - <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> -
              • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> - -
              • - <%= render :partial => 'student_work_praise' %> -
              • - <% end%> -
                - -
              • - 编程代码: -
                -
                -
                -
                -
              • - -
              • - - 测试结果: - -
                - <% work.student_work_tests.each_with_index do |test, index| %> -
                -

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

                - - <%= test.created_at.to_s(:db) %> - -
                -
                - <% if test.status.to_i == -2 %> -
                - <%= test.results.first %> -
                - <% else %> -
                -
                  - <% test.results.each_with_index do |x, i| %> -
                • - 测试<%=i+1%> - <% if x["status"].to_i != 0 %> - 测试错误! - 您的输出: - <%=x["result"]%> - 正确输出: - <%=x["output"]%> -
                  - <% else %> - 测试正确! -
                  - <% end %> -
                • - <% end %> -
                -
                - <% end %> - <% end %> -
                -
              • - -
              • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> - -
                - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
                - <% end%> -
                -
              • -
              - -
              - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
              -
              - -
              - <%student_work_scores.each do |student_score|%> -
              - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
              - <% end%> -
              - - 收起 -
              - - +
              +
              +
                +
              • + 上交时间: + <%=format_time work.created_at %> +
              • + + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> + +
              • + <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> +
              • +
              • + <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> +
              • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> + +
              • + <%= render :partial => 'student_work_praise' %> +
              • + <% end%> +
                + +
              • + 编程代码: +
                +
                +
                +
                +
              • + +
              • + + 测试结果: + +
                + <% work.student_work_tests.each_with_index do |test, index| %> +
                +

                + 第<%= work.student_work_tests.count - index%>次测试 +

                + + <%= test.created_at.to_s(:db) %> + +
                +
                + <% if test.status.to_i == -2 %> +
                + <%= test.results.first %> +
                + <% else %> +
                +
                  + <% test.results.each_with_index do |x, i| %> +
                • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
                  + <% else %> + 测试正确! +
                  + <% end %> +
                • + <% end %> +
                +
                + <% end %> + <% end %> +
                +
              • + +
              • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + +
                + <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> +
                + <% end%> +
                +
              • +
              + +
              + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
              +
              + +
              + <%student_work_scores.each do |student_score|%> +
              + <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
              + <% end%> +
              +
              + + 收起 +
              +
              + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 662ddece4..d66a30718 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,139 +1,140 @@ -
              -
              - <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> - <% if @homework.homework_type != 3 %> - <% is_my_work = work.user == User.current%> - <% else %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% is_my_work = pro && pro.student_work_id == work.id%> - <% end %> -
                -
              • - 上交时间: - <%=format_time work.created_at %> -
              • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
              • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> -
              • -
              • - <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> -
              • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> - -
              • - <%= render :partial => 'student_work_praise' %> -
              • - <% end%> -
                - - - - <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> -
                -
              • - 参与人员: - <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> - <% members = work.student_work_projects.where("is_leader = 0") %> - <% members.each do |member| if !members.empty? %> - 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> - <% end %> - <% end %> -
              • - <% if @homework.homework_detail_group.base_on_project == 1 %> -
              • - 关联项目: - <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - <% else %> - <%=work.project.name %> - <% end %> - <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - (综合评分:<%=work.project.project_score.score.to_i %>) -
              • - <% end %> - <% end%> - -
              • - 内容: -
                - <%= text_format(work.description) if work.description%> -
                -
                -
              • -
              • - 附件: - <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> - <% if com_attachments.empty?%> - 尚未提交附件 - <% else%> -
                - <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> -
                - <% end%> -
                -
              • -
              • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> - -
                - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
                - <% end%> -
                -
              • -
              - -
              - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
              -
              - -
              - <%student_work_scores.each do |student_score|%> -
              - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
              - <% end%> -
              - - 收起 -
              -
              - \ No newline at end of file diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb index c4b2a795e..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,7 +1,7 @@ <% attachments.each_with_index do |attachment,i| %>
              - + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> From 520811fdc79fbae2b94644ee016322774bb694a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 11:17:55 +0800 Subject: [PATCH 829/913] =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8C=89=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 18 ++++++----------- app/controllers/words_controller.rb | 1 + app/models/journals_for_message.rb | 2 +- ...160126024429_update_journal_for_message.rb | 20 +++++++++++++++++++ db/schema.rb | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20160126024429_update_journal_for_message.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8794808a3..cb8afd3a1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -755,23 +755,17 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "public" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC') when "private" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC') else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 699a5e8ca..351be4e64 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -62,6 +62,7 @@ class WordsController < ApplicationController update_forge_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id) + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) end respond_to do |format| # format.html { diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 9e0ce2dd2..cdcf9d19e 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! - after_update :update_ativity + #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score diff --git a/db/migrate/20160126024429_update_journal_for_message.rb b/db/migrate/20160126024429_update_journal_for_message.rb new file mode 100644 index 000000000..f6b848c79 --- /dev/null +++ b/db/migrate/20160126024429_update_journal_for_message.rb @@ -0,0 +1,20 @@ +class UpdateJournalForMessage < ActiveRecord::Migration + def up + journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ") + count = journals.count / 30 + 2 + transaction do + for i in 1 ... count do i + journals.page(i).per(30).each do |jour| + act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first + unless act.nil? + jour.updated_on = act.updated_at + jour.save + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8af34d878..736ce0f4e 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 => 20160122143138) do +ActiveRecord::Schema.define(:version => 20160126024429) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 19003f27fca2dcbd89d4c79ad829bbbbc9205882 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:05:45 +0800 Subject: [PATCH 830/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0is?= =?UTF-8?q?=5Fcopy=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 5 ++++- db/migrate/20160126031857_add_is_copy_to_course.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160126031857_add_is_copy_to_course.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..0697f0d0a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -441,7 +441,10 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) + @course.is_copy = 1 + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| diff --git a/db/migrate/20160126031857_add_is_copy_to_course.rb b/db/migrate/20160126031857_add_is_copy_to_course.rb new file mode 100644 index 000000000..f60914bbd --- /dev/null +++ b/db/migrate/20160126031857_add_is_copy_to_course.rb @@ -0,0 +1,5 @@ +class AddIsCopyToCourse < ActiveRecord::Migration + def change + add_column :courses, :is_copy, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 736ce0f4e..42a5ea702 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 => 20160126024429) do +ActiveRecord::Schema.define(:version => 20160126031857) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160126024429) do t.string "end_term" t.integer "is_excellent", :default => 0 t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 end create_table "custom_fields", :force => true do |t| From 89a919163c58a751f13d07cdb47ae14574fd1d02 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 26 Jan 2016 15:25:25 +0800 Subject: [PATCH 831/913] =?UTF-8?q?=E4=B8=80=E6=97=A6=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=A7=81=E6=9C=89=EF=BC=8C=E5=B0=B1disabled=E6=8E=89=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/new.html.erb | 5 +++-- app/views/organizations/setting.html.erb | 14 ++++++++++++-- public/javascripts/application.js | 13 +++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index ea7fbbb30..e12bf3849 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,14 +30,15 @@
            • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
            • - + (打钩为允许游客下载文件) +
            • diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 9ec118bec..b9b2f9b4c 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -63,11 +63,12 @@
            • 公开 : - class="ml3" /> + class="ml3" />
              下载支持 : - class="ml3" /> + name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />  允许游客下载 + <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
              保存 <% end %> @@ -187,4 +188,13 @@ $("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入"); } } + +// $(document).ready(function(){ +// if ( $("#is_public").attr("checked") != true){ +// alert($(this).attr("checked")); +// $("#allow_download").attr("checked", false); +// $("#allow_download").attr("disabled", true); +// $("#allow_down_hint").html(""); +// } +// }); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index f982d92f6..8fba6770a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1135,3 +1135,16 @@ function chooseSendType(res_id,res_ids, user_id, send_type){ } lastSendType = sendType; } + +function disable_down(source, des, hint){ + if (source.attr("checked")){ + des.attr("disabled", false); + hint.html(""); + } + else{ + des.attr("checked", false); + des.attr("disabled", true); + hint.html("(私有组织不允许游客下载资源)"); + + } +} From af7ca36c92ad8f8bcbf0931e8d4293d292b05243 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jan 2016 15:59:39 +0800 Subject: [PATCH 832/913] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=96=E9=80=80=E5=87=BA=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 9 ++++----- app/views/layouts/_project_info.html.erb | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4e90fc106..f326f2099 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -697,17 +697,16 @@ module CoursesHelper def join_in_course_header(course, user, options=[]) if user.logged? joined = course.members.map{|member| member.user_id}.include? user.id - text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student)) + text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link = "#{l(:label_course_join_student)}" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "#{l(:label_course_exit_student)}".html_safe + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") end else - link = "#{l(:label_course_join_student)}" + - "#{l(:label_course_exit_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index d4b5b20fe..db9e24a36 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -15,7 +15,10 @@ <% end %>
              -加入课程 + <% unless is_teacher %> + +
              <%= join_in_course_header(@course, User.current) %>
              + <% end %>
              <% case object_flag %> <% when '10' %> From 4b95ee95c073876faa641a07dfa6dfc87b70e981 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 27 Jan 2016 16:12:34 +0800 Subject: [PATCH 837/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=B8=96=E5=AD=90=EF=BC=8C=E5=9C=A8=E7=99=BB=E9=99=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=B0=B1=E8=83=BD=E5=8F=91=E9=80=81=EF=BC=9B?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E7=BB=87=E6=A0=8F=E7=9B=AE=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=B8=96=E5=AD=90=E6=A0=8F=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=BE=91=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E3=80=81=E5=8F=91=E9=80=81=E9=80=89=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../messages/_org_subfield_show.html.erb | 2 +- .../_org_subfield_message.html.erb | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 7fdf5d02c..1e31881d5 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -68,7 +68,7 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
              - <% if @message.org_subfield_editable_by?(User.current) %> + <% if User.current.logged? %>
              From ec41cd4318c79ae5637c44c7299310d59d2d685e Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jan 2016 17:26:57 +0800 Subject: [PATCH 838/913] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E9=A2=98=E5=BA=93=E4=B8=AD=E7=9A=84=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 57 ++++++++++++++- .../_homework_detail_information.html.erb | 27 +++++++ .../users/_homework_search_input.html.erb | 29 ++++++++ .../users/_show_user_homework_form.html.erb | 33 ++++++--- app/views/users/_show_user_homeworks.html.erb | 71 ++++++++++++------- app/views/users/_user_homework_form.html.erb | 2 +- app/views/users/show_homework_detail.js.erb | 1 + app/views/users/user_homework_type.js.erb | 4 ++ app/views/users/user_import_homeworks.js.erb | 7 +- app/views/users/user_search_homeworks.js.erb | 4 +- config/routes.rb | 6 +- public/stylesheets/new_user.css | 23 +++++- public/stylesheets/public.css | 21 ++++++ 13 files changed, 238 insertions(+), 47 deletions(-) create mode 100644 app/views/users/_homework_detail_information.html.erb create mode 100644 app/views/users/_homework_search_input.html.erb create mode 100644 app/views/users/show_homework_detail.js.erb create mode 100644 app/views/users/user_homework_type.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cb8afd3a1..51feecb23 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -403,8 +403,47 @@ class UsersController < ApplicationController #导入作业 def user_import_homeworks + @user = User.current @select_course = params[:select_course] ? 1 : 0 - @user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 + respond_to do |format| + format.js + end + end + + def user_homework_type + @user = User.current + if(params[:type].blank? || params[:type] == "1") #公共题库 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + elsif params[:type] == "2" #我的题库 + @homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + end + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 + respond_to do |format| + format.js + end + end + + def show_homework_detail + @homework = HomeworkCommon.find params[:homework].to_i respond_to do |format| format.js end @@ -412,7 +451,21 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks - @user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc") + search = params[:name].to_s.strip.downcase + if(params[:type].blank? || params[:type] == "1") #全部 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and (name like '%#{search}%')").order("created_at desc") + elsif params[:type] == "2" #课程资源 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and (name like '%#{search}%')").order("created_at desc") + end + @type = params[:type] + @limit = 10 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,10 respond_to do |format| format.js end diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb new file mode 100644 index 000000000..6887444ab --- /dev/null +++ b/app/views/users/_homework_detail_information.html.erb @@ -0,0 +1,27 @@ +
              题目信息
              +
              + <% if homework.nil? %> + 请先在左侧选择作业 + <% else %> +
              标题:<%=homework.name %>
              + 来源:<%=homework.course.name %>
              + <% if homework.homework_type == 2 && homework.homework_detail_programing %> + 编程语言:<%=homework.language_name %>
              + <% end %> + 贡献者:<%=homework.user.show_name %>
              + 描述如下: +
              +
              + <%=homework.description.html_safe %> +
              + <% if homework.homework_type == 2 %> +
              + 测试集:<%=homework.homework_tests.count %>组 +
              + <% elsif homework.homework_type ==3 && homework.homework_detail_group %> +
              + 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人 +
              + <% end %> + <% end %> +
              \ No newline at end of file diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb new file mode 100644 index 000000000..ba85f0d09 --- /dev/null +++ b/app/views/users/_homework_search_input.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index ef0265683..bd70e27fb 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -1,13 +1,24 @@ -<% user_homeworks.each do |homework|%> -
                -
              • - -
              • - +
              • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
              • <%= homework.user.show_name %>
              • <%=format_date homework.publish_time %>
              diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index ad1fcdf7a..f013705c5 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -10,13 +10,14 @@
                +
              • 作业类型
              • 贡献者
              • 发布时间
              <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> -
              +
              <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
              <% end %> diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 409b914b4..3f5c21567 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1442,14 +1442,15 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:360px; padding-left:10px;} +.subjectName {width:260px; padding-left:10px;} +.subjectType {width:100px; text-align:center;} .subjectPublisher {width:100px; text-align:center;} .subjectDate {width:115px; text-align:center;} -.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:40px; line-height:40px; vertical-align:middle;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} .subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} .subjectIntro {color:#585858; line-height:18px; font-size:12px;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 611e96a2c..2d6bad0a1 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -1027,13 +1027,14 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} .subjectName {width:360px; padding-left:10px;} +.subjectType {width:100px; text-align:center;} .subjectPublisher {width:100px; text-align:center;} .subjectDate {width:115px; text-align:center;} -.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:40px; line-height:40px; vertical-align:middle;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} .subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} .subjectIntro {color:#585858; line-height:18px; font-size:12px;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} From c857fb734b5306248d87c8c10d92a09dad5307b1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 28 Jan 2016 10:16:45 +0800 Subject: [PATCH 840/913] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E8=AE=BE=E7=BD=AE=E5=9B=9E=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E9=AB=98=E5=BA=A6=E5=92=8C=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_org_subfield_show.html.erb | 2 +- public/javascripts/application.js | 3 +++ public/javascripts/create_kindeditor.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 1e31881d5..fab0f752e 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -58,7 +58,7 @@ } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8fba6770a..7f60b11b4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1032,6 +1032,7 @@ function subfield_click(){ $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); } +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { $('#'+fieldId).each(function() { var $this = $(this); @@ -1107,6 +1108,7 @@ function show_send(id, user_id, send_type){ //id 发送的id //发送的id数组 +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function chooseSendType(res_id,res_ids, user_id, send_type){ sendType = $(".resourcesSendType").val(); @@ -1136,6 +1138,7 @@ function chooseSendType(res_id,res_ids, user_id, send_type){ lastSendType = sendType; } +//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 function disable_down(source, des, hint){ if (source.attr("checked")){ des.attr("disabled", false); diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index 0eac4b01e..ea6262931 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -10,16 +10,16 @@ function sd_create_editor(params){ resizeType : 1,minWidth:"1px",width:"94%", height:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", + width:params.width, items:['emoticons','fontname', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'formatblock', 'fontsize', '|','indent', 'outdent', '|','imagedirectupload'], afterChange:function(){//按键事件 - var edit = this.edit; var body = edit.doc.body; edit.iframe.height(paramsHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); + //this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); }, afterBlur:function(){ //params.toolbar_container.hide(); From a613b58b46fd321779113d183e37bc6109c71c39 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 28 Jan 2016 11:08:16 +0800 Subject: [PATCH 841/913] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E7=9A=84=E9=AB=98=E5=BA=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_programing_attr.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index 3f2e53fe8..71816689b 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -7,7 +7,7 @@ <%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
              -
              +
              <% if edit_mode && homework.is_program_homework? %> <% homework.homework_tests.each_with_index do |test, index| %>
              From c942c843b94fec9d660b60e64e87728bb7958b9d Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 28 Jan 2016 16:27:46 +0800 Subject: [PATCH 842/913] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=95=E7=94=A8=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 21 ++++++++++++------- .../_homework_detail_information.html.erb | 6 +++++- .../users/_show_user_homework_form.html.erb | 1 + app/views/users/_show_user_homeworks.html.erb | 3 ++- app/views/users/_user_homework_form.html.erb | 3 +++ app/views/users/user_select_homework.js.erb | 1 + .../20160128024452_add_quotes_to_homework.rb | 5 +++++ db/schema.rb | 3 ++- public/stylesheets/new_user.css | 9 ++++---- public/stylesheets/public.css | 9 ++++---- 10 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20160128024452_add_quotes_to_homework.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9cf69504b..190784f26 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -408,7 +408,7 @@ class UsersController < ApplicationController #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") @type = params[:type] @limit = 15 @is_remote = true @@ -426,9 +426,9 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #公共题库 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids}").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") elsif params[:type] == "2" #我的题库 - @homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") end @type = params[:type] @limit = 15 @@ -451,13 +451,14 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks + @user = User.current search = params[:name].to_s.strip.downcase if(params[:type].blank? || params[:type] == "1") #全部 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and (name like '%#{search}%')").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'} and (name like '%#{search}%')").order("created_at desc") elsif params[:type] == "2" #课程资源 - @homeworks = HomeworkCommon.where("user_id = #{@user.id} and (name like '%#{search}%')").order("created_at desc") + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") end @type = params[:type] @limit = 15 @@ -479,6 +480,7 @@ class UsersController < ApplicationController @homework = HomeworkCommon.new @select_course = params[:select_course] || 0 if homework + @ref_homework = homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time @@ -636,13 +638,15 @@ class UsersController < ApplicationController homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - + if params[:quotes] && !params[:quotes].blank? + homework = HomeworkCommon.find params[:quotes].to_i + homework.update_attribute(:quotes, homework.quotes+1) + end if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) else redirect_to user_homeworks_user_path(User.current.id) end - end end else @@ -1681,7 +1685,8 @@ class UsersController < ApplicationController end attach_copied_obj.save unless Project.find(project_id).project_score.nil? - Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + Project.find(project_id).project_score.update_attribute(:attach_num, + Project.find(project_id).project_score.attach_num + 1) end end end diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb index 6887444ab..d650cd084 100644 --- a/app/views/users/_homework_detail_information.html.erb +++ b/app/views/users/_homework_detail_information.html.erb @@ -8,7 +8,11 @@ <% if homework.homework_type == 2 && homework.homework_detail_programing %> 编程语言:<%=homework.language_name %>
              <% end %> - 贡献者:<%=homework.user.show_name %>
              + 贡献者:<%=homework.user.show_name %> + <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %> + ,<%=homework.user.user_extensions.occupation%> + <% end %> +
              描述如下:
              diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index b316093c3..43d204508 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -16,6 +16,7 @@ 分组 <% end %> +
            • <%= homework.quotes %>
            • <%= homework.user.show_name %>
            • <%=format_date homework.publish_time %>
            • diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index f013705c5..9f90a633f 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -10,7 +10,8 @@
                -
              • 作业类型
              • +
              • 类型
              • +
              • 引用数
              • 贡献者
              • 发布时间
              diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 5781a3416..4082854da 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -34,6 +34,9 @@
              <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> + <% unless edit_mode %> + + <% end %> <% if edit_mode %> <% end %> diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 9b4b43b33..306374b84 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,6 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); <% if @select_course == "0"%> $("#course_id").val("<%= @homework.course_id%>"); <% end%> +$("#ref_homework_id").val("<%= @ref_homework.id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); <% if @homework_detail_group %> diff --git a/db/migrate/20160128024452_add_quotes_to_homework.rb b/db/migrate/20160128024452_add_quotes_to_homework.rb new file mode 100644 index 000000000..7f02062fb --- /dev/null +++ b/db/migrate/20160128024452_add_quotes_to_homework.rb @@ -0,0 +1,5 @@ +class AddQuotesToHomework < ActiveRecord::Migration + def change + add_column :homework_commons, :quotes, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 42a5ea702..4539131c1 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 => 20160126031857) do +ActiveRecord::Schema.define(:version => 20160128024452) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -783,6 +783,7 @@ ActiveRecord::Schema.define(:version => 20160126031857) do t.datetime "updated_at", :null => false t.integer "teacher_priority", :default => 1 t.integer "anonymous_comment", :default => 0 + t.integer "quotes", :default => 0 end add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 3f5c21567..d31c1ee0c 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1442,10 +1442,11 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:260px; padding-left:10px;} -.subjectType {width:100px; text-align:center;} -.subjectPublisher {width:100px; text-align:center;} -.subjectDate {width:115px; text-align:center;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} .subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} .subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 2d6bad0a1..be9d51799 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -1026,10 +1026,11 @@ a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} .subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:360px; padding-left:10px;} -.subjectType {width:100px; text-align:center;} -.subjectPublisher {width:100px; text-align:center;} -.subjectDate {width:115px; text-align:center;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} .subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} .subjectRow li {height:30px; line-height:30px; vertical-align:middle;} .subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} From 280f679b0c24c1125dd3fc091e5c76f1f84c9617 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 28 Jan 2016 16:49:25 +0800 Subject: [PATCH 843/913] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98=E5=BF=AB=E6=8D=B7=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E5=AE=BD=E5=BA=A6=EF=BC=9B2.https://www.trus?= =?UTF-8?q?tie.net/manual/feedback=E9=93=BE=E6=8E=A5=E5=88=B0=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E4=B8=AD=E5=BF=83=EF=BC=9B3.=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A1=86=E6=98=BE=E7=A4=BA=E6=9B=B4=E5=A4=9A=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue_detail.html.erb | 14 +++++++------- config/routes.rb | 1 + public/javascripts/create_kindeditor.js | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index 774d92cb9..1235b4e53 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -57,12 +57,12 @@ <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
            •  指派  : 

              - - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> + + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %> <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, - {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> + {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"undis issueEdit", :style => "width:130px;"}) %>
            • <% end %>
              @@ -93,22 +93,22 @@
              •  开始  : 

                -

                <%= format_date(activity.start_date) %>

                +

                <%= format_date(activity.start_date) %>

              •  周期  : 

                - <%= l_hours(activity.estimated_hours) %>
              • + <%= l_hours(activity.estimated_hours) %>
              •  计划完成  : 

                - <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
              • + <%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %>
              •  目标版本  : 

                - <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
              • + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
              diff --git a/config/routes.rb b/config/routes.rb index 07c161265..da876d664 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1128,6 +1128,7 @@ RedmineApp::Application.routes.draw do match "/system_log" ,:to => 'system_log#index' match 'system_log/clear' get 'upload_files_menu', :to => 'files#upload_files_menu' + get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168") ##ended by lizanle resources :git_callback do diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index ea6262931..bc28aa2bd 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -14,7 +14,7 @@ function sd_create_editor(params){ items:['emoticons','fontname', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'formatblock', 'fontsize', '|','indent', 'outdent', - '|','imagedirectupload'], + '|','imagedirectupload','more'], afterChange:function(){//按键事件 var edit = this.edit; var body = edit.doc.body; From e9a7f6f82667136f49114bddcf8c2f0ef222ac95 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 11:02:57 +0800 Subject: [PATCH 844/913] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=90=E7=BB=A9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 56 +++++++++++++++++++++++---- app/helpers/courses_helper.rb | 2 +- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0697f0d0a..0961f2480 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -321,11 +321,12 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") + @homeworks = @course.homework_commons.order("created_at desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; respond_to do |format| format.xls { - send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", + send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition("#{filename}.xls")) } end @@ -963,7 +964,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -975,7 +976,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -1009,16 +1010,54 @@ class CoursesController < ApplicationController end - def member_to_xls members,groups + def member_to_xls homeworks, course, members,groups xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "student" - blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 - sheet1.row(0).default_format = blue + #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_class),l(:excel_f_score),l(:excel_commit_time)]) + sheet1[0,0] = "课程编号" + sheet1[0,1] = course.id + sheet1[1,0] = "课程学期" + sheet1[1,1] = course.time.to_s+"年"+course.term + sheet1[2,0] = "课程名称" + sheet1[2,1] = course.name + sheet1[3,0] = "教师团队" + sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet1[4,0] = "主讲教师" + sheet1[4,1] = course.teacher.show_name + sheet1[5,0] = "排名" + sheet1[5,1] = "学生姓名" + sheet1[5,2] = "昵称" + sheet1[5,3] = "学号" + for i in 0 ... homeworks.count + sheet1[5,i+4] = "第"+(i+1).to_s+"次" + end + sheet1[5,homeworks.count+4] = "总成绩" + sheet1[5,0] = "排名" + sheet1[5,0] = "排名" + count_row = 6 + members.each_with_index do |member, i| + sheet1[count_row,0]= i+1 + sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s + sheet1[count_row,2] = member.user.login + sheet1[count_row,3] = member.user.user_extensions.student_id + homeworks.each_with_index do |homework, j| + student_works = homework.student_works.where("user_id = #{member.user.id}") + if student_works.empty? + sheet1[count_row,j+4] = format("%0.2f",0) + else + final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score + score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty + sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score) + end + end + sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s) + count_row += 1 + end - 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_score)]) - count_row = 1 +=begin group0 = CourseGroup.new(); group0.id = 0; group0.name = l(:excel_member_with_out_class) @@ -1040,6 +1079,7 @@ class CoursesController < ApplicationController end end end +=end book.write xls_report xls_report.string end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index f326f2099..1e4cedf14 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -795,7 +795,7 @@ module CoursesHelper # 学生按作业总分排序,取前8个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{course.id} From d3ba23bc64d1a64f033017056dbd7fd0dc164674 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 15:37:03 +0800 Subject: [PATCH 845/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 11 +++++ app/controllers/homework_common_controller.rb | 6 ++- .../_user_homework_search_list.html.erb | 46 +++++++++++++++++++ app/views/courses/homework_search.js.erb | 5 ++ .../_homework_search_form.html.erb | 6 +++ app/views/homework_common/index.html.erb | 5 +- app/views/users/_user_homework_list.html.erb | 4 +- config/routes.rb | 1 + 8 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 app/views/courses/_user_homework_search_list.html.erb create mode 100644 app/views/courses/homework_search.js.erb create mode 100644 app/views/homework_common/_homework_search_form.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0961f2480..97dacb178 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -907,6 +907,17 @@ class CoursesController < ApplicationController return 404 end end + #搜索作业 + def homework_search + @search = "%#{params[:search].strip.downcase}%" + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + @page = params[:page] ? params[:page].to_i + 1 : 0 + if @is_teacher + @homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end + end private def update_quotes attachment diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d345fba5f..398b385a4 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController @new_homework.homework_detail_manual = HomeworkDetailManual.new @new_homework.course = @course @page = params[:page] ? params[:page].to_i + 1 : 0 - @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + if @is_teacher + @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] diff --git a/app/views/courses/_user_homework_search_list.html.erb b/app/views/courses/_user_homework_search_list.html.erb new file mode 100644 index 000000000..585d8761a --- /dev/null +++ b/app/views/courses/_user_homework_search_list.html.erb @@ -0,0 +1,46 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> +<% end %> + + +
              + <% homework_commons.each do |homework_common|%> + + <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> + <% end%> + <% if homework_commons.count == 10%> + <%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> + <% end%> +
              \ No newline at end of file diff --git a/app/views/courses/homework_search.js.erb b/app/views/courses/homework_search.js.erb new file mode 100644 index 000000000..3c644ad9e --- /dev/null +++ b/app/views/courses/homework_search.js.erb @@ -0,0 +1,5 @@ +<% if @page == 0 %> + $("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% else %> + $("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb new file mode 100644 index 000000000..aa3eef59e --- /dev/null +++ b/app/views/homework_common/_homework_search_form.html.erb @@ -0,0 +1,6 @@ +<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id), + :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> + + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> + +<% end %> \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index bc960154e..5c91a37fc 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -36,6 +36,9 @@
              作业
              +
              + <%= render :partial => 'homework_search_form',:locals => {:course=>@course} %> +
              @@ -50,8 +53,8 @@ <% end%>
              <% end%> - <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %> +
              diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 36f823a9a..28544fbf3 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,6 +14,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} +
              <% homework_commons.each do |homework_common|%> \ No newline at end of file diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index 668a26cec..53d556e86 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,13 +1,13 @@ -
              -
              - <%= content.to_s.html_safe%> -
              -
              - \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index b2c74a96c..29a9329a3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1217,6 +1217,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" + t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From 3aaa078a4bad4a0976d1c4bc3ce50b7399072547 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 16:26:00 +0800 Subject: [PATCH 847/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projects/_project_activities.html.erb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index deb0af842..7fc5c347c 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -1,4 +1,4 @@ -<%= import_ke(enable_at: true, prettify: false, init_activity: true) %> +<%= import_ke(enable_at: true,init_activity: true) %> <% unless forge_acts.empty? %> <% forge_acts.each do |activity| -%> @@ -68,7 +68,7 @@ } $(function () { - init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>"); + sd_create_editor_from_data(<%= activity.id %>, null, "100%", "<%= activity.class.to_s %>"); }); From dc3278274d5e7ae262a809047ef7a7625ef5dc30 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 16:55:07 +0800 Subject: [PATCH 848/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9kindeditor=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- .../_simple_ke_reply_form.html.erb | 2 +- app/views/blog_comments/quote.js.erb | 2 +- app/views/blog_comments/reply.js.erb | 2 +- app/views/blog_comments/show.html.erb | 2 +- app/views/blogs/_article.html.erb | 2 +- app/views/blogs/_article_list.html.erb | 22 +++++++++---------- app/views/boards/_course_show_detail.html.erb | 2 +- .../boards/_project_show_detail.html.erb | 2 +- app/views/comments/create.js.erb | 2 +- app/views/courses/_course_activity.html.erb | 2 +- app/views/courses/_courses_jours.html.erb | 2 +- app/views/courses/syllabus.html.erb | 4 ++-- .../set_evaluation_attr.js.erb | 4 ++-- .../start_anonymous_comment.js.erb | 4 ++-- .../stop_anonymous_comment.js.erb | 4 ++-- app/views/issues/_list.html.erb | 2 +- app/views/issues/add_journal.js.erb | 3 ++- app/views/issues/add_journal_in_org.js.erb | 2 +- app/views/memos/show.html.erb | 4 ++-- app/views/messages/_course_show.html.erb | 4 ++-- .../messages/_org_subfield_show.html.erb | 2 +- app/views/messages/_project_show.html.erb | 2 +- app/views/messages/_reply_message.html.erb | 2 +- app/views/messages/quote.js.erb | 2 +- app/views/messages/reply.js.erb | 2 +- app/views/news/_course_news_detail.html.erb | 2 +- app/views/news/_project_news_detail.html.erb | 2 +- .../_reply_form.html.erb | 2 +- .../_simple_ke_reply_form.html.erb | 2 +- .../org_document_comments/add_reply.js.erb | 2 +- .../org_document_comments/index.html.erb | 2 +- app/views/org_document_comments/quote.js.erb | 2 +- app/views/org_document_comments/show.html.erb | 2 +- .../org_subfields/_show_details.html.erb | 2 +- .../organizations/_org_activities.html.erb | 2 +- .../_org_course_homework.html.erb | 2 +- .../_org_course_message.html.erb | 2 +- .../organizations/_org_course_news.html.erb | 2 +- .../organizations/_org_project_issue.html.erb | 2 +- .../_org_subfield_message.html.erb | 2 +- .../organizations/_org_subfield_news.html.erb | 2 +- .../organizations/_project_message.html.erb | 2 +- .../organizations/_show_org_document.html.erb | 3 +-- app/views/organizations/show.html.erb | 2 +- .../projects/_project_activities.html.erb | 2 +- app/views/projects/_project_news.html.erb | 2 +- .../student_work/cancel_relate_project.js.erb | 4 ++-- .../forbidden_anonymous_comment.js.erb | 4 ++-- app/views/student_work/set_score_rule.js.erb | 4 ++-- .../student_work/student_work_project.js.erb | 4 ++-- app/views/users/_course_homework.html.erb | 2 +- .../users/_course_journalsformessage.html.erb | 2 +- app/views/users/_course_message.html.erb | 2 +- app/views/users/_course_news.html.erb | 2 +- app/views/users/_project_issue_reply.html.erb | 2 +- app/views/users/_project_message.html.erb | 2 +- app/views/users/_project_news.html.erb | 2 +- app/views/users/_user_activities.html.erb | 21 +++++++++--------- app/views/users/_user_blog.html.erb | 2 +- .../users/_user_homework_detail.html.erb | 2 +- app/views/users/_user_homework_list.html.erb | 2 +- .../users/_user_journalsformessage.html.erb | 2 +- app/views/users/_user_jours_list.html.erb | 20 ++++++++--------- app/views/words/create_reply.js.erb | 2 +- app/views/words/destroy.js.erb | 4 ++-- app/views/words/leave_homework_message.js.erb | 4 ++-- 67 files changed, 109 insertions(+), 108 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a0808bdd..ab091b61c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2808,7 +2808,7 @@ int main(int argc, char** argv){ end if opt[:init_activity] - ss += javascript_include_tag "init_activity_KindEditor" + ss += javascript_include_tag "create_kindeditor" end ss.html_safe diff --git a/app/views/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb index 61669058b..292587cad 100644 --- a/app/views/blog_comments/_simple_ke_reply_form.html.erb +++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb @@ -21,8 +21,8 @@ <% end %> +
              -

              diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb index cd53707d5..9bd226ce1 100644 --- a/app/views/blog_comments/quote.js.erb +++ b/app/views/blog_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>"); + sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @blogComment.id%>").length >0) { $("#reply_to_message_<%= @blogComment.id%>").replaceWith("

              "); diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 2a4e71f1c..915ab892d 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -5,4 +5,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); //init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); \ No newline at end of file diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 4a407089f..e6d8be24e 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -27,7 +27,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @article.id%>,null,"85%", '<%=@article.class.to_s%>'); + sd_create_editor_from_data(<%= @article.id%>,null,"100%", '<%=@article.class.to_s%>'); showNormalImage('message_description_<%= @article.id %>'); }); diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 4ca86e7ae..05f69055f 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -198,8 +198,8 @@ +
              -

              diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb index ca85c0ba2..f3fd1aa61 100644 --- a/app/views/blogs/_article_list.html.erb +++ b/app/views/blogs/_article_list.html.erb @@ -1,19 +1,19 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> <% if topic %> diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb index 1898fce02..88fd7d224 100644 --- a/app/views/boards/_course_show_detail.html.erb +++ b/app/views/boards/_course_show_detail.html.erb @@ -40,7 +40,7 @@ } $(function () { - init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>"); + sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>"); }); <% if topic %> diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb index 367f0552c..fc24dfd09 100644 --- a/app/views/boards/_project_show_detail.html.erb +++ b/app/views/boards/_project_show_detail.html.erb @@ -39,7 +39,7 @@ } $(function () { - init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); + sd_create_editor_from_data(<%= topic.id%>, null, "100%"); }); <% if topic %> diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index f94eda065..0814b5f50 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -5,4 +5,4 @@ <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); <% end %> -init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity"); +sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity"); diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 1b0d5330d..65aa142af 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -107,7 +107,7 @@ } $(function () { - init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>"); + sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>"); }); <% if activity && activity.course_act%> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 0c4f4c1e0..c7e4a7428 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -32,9 +32,9 @@
              <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> +

              -
              取消 留言 <% end %> diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index c9d333e6d..3bace514b 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -40,7 +40,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>"); + sd_create_editor_from_data(<%= @article.id%>,null,"100%", "<%=@article.class.to_s%>"); showNormalImage('message_description_<%= @article.id %>'); }); @@ -201,8 +201,8 @@ +
              -

              diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index 73436750c..987abd351 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,8 +1,8 @@ clickCanel(); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% end %> \ No newline at end of file diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index 8b2e9ed04..91a68011e 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -3,11 +3,11 @@ <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); $("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); $("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% end %> /*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ <% elsif @statue == 2 %> diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 2f8d8c6d6..874374476 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -2,11 +2,11 @@ alert('关闭成功'); <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); $("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); $("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); <% end %> /* $("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 2a1ae56d4..3ee20ee2a 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -18,7 +18,7 @@ } $(function () { - init_activity_KindEditor_data(<%= issue.id%>, null, "87%", "<%= issue.class.name %>"); + sd_create_editor_from_data(<%= issue.id%>, null, "100%", "<%= issue.class.name %>"); }); <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 9099c31b6..43d7f741b 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -21,6 +21,7 @@ sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); + sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity"); +//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb index 34e874f13..ed4666d0c 100644 --- a/app/views/issues/add_journal_in_org.js.erb +++ b/app/views/issues/add_journal_in_org.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 3028f3369..e59c8359d 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -34,7 +34,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @memo.id%>,null,"87%", "<%=@memo.class.to_s%>"); + sd_create_editor_from_data(<%= @memo.id%>,null,"100%", "<%=@memo.class.to_s%>"); }); function del_confirm(){ @@ -124,8 +124,8 @@ <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> <%= f.hidden_field :parent_id, :required => true, value: @memo.id %> <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> +
              -

              diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 022b8c76b..00f22cc95 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -27,7 +27,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); @@ -175,4 +175,4 @@ postContent = postContent.replace(/ /g," "); $("#message_description_<%= @topic.id %>").html(postContent); }); - + diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index fab0f752e..5fc7ed746 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -58,7 +58,7 @@ } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index a0e9db171..2009c7133 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -88,7 +88,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index a859a088a..15cb465de 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -18,8 +18,8 @@ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> +
              -

              diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index b0e8ecb85..89f953bb9 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>"); + sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>"); }); }else if($("#reply_to_message_<%= @message.id%>").length >0) { $("#reply_to_message_<%= @message.id%>").replaceWith("

              "); diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index f61de74f0..385a49a82 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -5,4 +5,4 @@ <% elsif @org_subfield %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> -init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/news/_course_news_detail.html.erb b/app/views/news/_course_news_detail.html.erb index 954f7dbf1..6092a8590 100644 --- a/app/views/news/_course_news_detail.html.erb +++ b/app/views/news/_course_news_detail.html.erb @@ -40,7 +40,7 @@ } $(function () { - init_activity_KindEditor_data(<%= news.id%>, null, "87%"); + sd_create_editor_from_data(<%= news.id%>, null, "100%"); showNormalImage('activity_description_<%= news.id %>'); }); diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb index fdb035bf5..a0610ae63 100644 --- a/app/views/news/_project_news_detail.html.erb +++ b/app/views/news/_project_news_detail.html.erb @@ -40,7 +40,7 @@ } $(function () { - init_activity_KindEditor_data(<%= news.id%>, null, "87%"); + sd_create_editor_from_data(<%= news.id%>, null, "100%"); showNormalImage('activity_description_<%= news.id %>'); }); diff --git a/app/views/org_document_comments/_reply_form.html.erb b/app/views/org_document_comments/_reply_form.html.erb index 8808ff8b7..60db259c6 100644 --- a/app/views/org_document_comments/_reply_form.html.erb +++ b/app/views/org_document_comments/_reply_form.html.erb @@ -1,2 +1,2 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); diff --git a/app/views/org_document_comments/_simple_ke_reply_form.html.erb b/app/views/org_document_comments/_simple_ke_reply_form.html.erb index cfa197ff4..c0166f5ce 100644 --- a/app/views/org_document_comments/_simple_ke_reply_form.html.erb +++ b/app/views/org_document_comments/_simple_ke_reply_form.html.erb @@ -18,8 +18,8 @@ <%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %> +
              -

              diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 968d7295d..79858dd03 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,2 +1,2 @@ $("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>"); -init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>"); +sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>"); diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index 7734a2853..7dba82d9a 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -19,7 +19,7 @@ <% @documents.each do |document| %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> diff --git a/app/views/org_document_comments/quote.js.erb b/app/views/org_document_comments/quote.js.erb index 7ea5daf7b..53d22eb58 100644 --- a/app/views/org_document_comments/quote.js.erb +++ b/app/views/org_document_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @org_comment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%", "<%=@org_comment.class.to_s%>"); + sd_create_editor_from_data(<%= @org_comment.id%>,null,"100%", "<%=@org_comment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @org_comment.id %>").length >0) { $("#reply_to_message_<%= @org_comment.id%>").replaceWith("

              "); diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 405631369..561364d64 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -1,7 +1,7 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %> diff --git a/app/views/org_subfields/_show_details.html.erb b/app/views/org_subfields/_show_details.html.erb index eda9c9d57..3a605f75d 100644 --- a/app/views/org_subfields/_show_details.html.erb +++ b/app/views/org_subfields/_show_details.html.erb @@ -38,7 +38,7 @@ <% org_activities.each do |act| %> <% if act.container_type == 'Organization' %> diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 6579ccbca..20b98ffa0 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -38,7 +38,7 @@ <% org_activities.each do |act| %> <% if act.container_type == 'Organization' %> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 3dccdcc2b..b5e3c6958 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -326,8 +326,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %> +
              -

              diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index 339ff8b26..4f13e1b4f 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -142,8 +142,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index b6e2f74ef..665f5c1ae 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -108,8 +108,8 @@
              <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 763a76d5e..2495e0044 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -125,8 +125,8 @@
              <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index a14138903..4763089a0 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -143,8 +143,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 41eb473e8..891ad14a7 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -128,8 +128,8 @@
              <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index baa687107..6cc3f5740 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -120,8 +120,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
              -

              diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index b29bac7d1..da458636a 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -117,9 +117,8 @@
              <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> +
              - -
              diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 78fb12279..a271abe02 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -61,7 +61,7 @@ <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index 7fc5c347c..062d64096 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -1,4 +1,4 @@ -<%= import_ke(enable_at: true,init_activity: true) %> +<%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% user_activities.each do |user_activity| if user_activities %> @@ -74,7 +75,7 @@ } $(function() { - init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%", "<%=user_activity.class.to_s%>"); + sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>"); }); <% unless user_activity.act_type == "ProjectCreateInfo" %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 7658bc581..244951dfa 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -120,8 +120,8 @@ +
              -

              diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 36b2be34f..01673d164 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -328,8 +328,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %> <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %> +
              -

              diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 36f823a9a..e55065c52 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -17,7 +17,7 @@ <% homework_commons.each do |homework_common|%> <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>0} %> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d4d9a2cd7..285866f9d 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -5,7 +5,7 @@ <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); <% end %> - init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> $("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>"); diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 6a56249a3..cd48ae74c 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -19,10 +19,10 @@ <% elsif @homework%> <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% end %> <% end %> var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') diff --git a/app/views/words/leave_homework_message.js.erb b/app/views/words/leave_homework_message.js.erb index 5eeb9ce64..acb16be50 100644 --- a/app/views/words/leave_homework_message.js.erb +++ b/app/views/words/leave_homework_message.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% elsif @homework_common_id && @is_in_course %> $("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework_common_id%>,"","87%", "HomeworkCommon"); + sd_create_editor_from_data(<%= @homework_common_id%>,"","100%", "HomeworkCommon"); <% end %> From 8358140c87d14a232aad9d97cc1c28ac7c9df750 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 17:02:25 +0800 Subject: [PATCH 849/913] =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=89=88=E6=9C=AC=E5=AD=97=E4=BD=93=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/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a0808bdd..9f516ae1a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper def link_to_user_version(version, options = {}) return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue" end # 判断课程是否为精品课程 From 68bd1098319f4388cd8b821b0664f419a2af63e0 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 17:26:28 +0800 Subject: [PATCH 850/913] =?UTF-8?q?=E5=AF=B9=E5=AD=90=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=89=B9=E5=87=86=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/organizations/setting.html.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index b9b2f9b4c..a91a079ef 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -58,6 +58,11 @@
              http:// .trustie.net申请 + <% if @organization.domain.present? %> + (已批准) + <% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %> + (您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准) + <% end %>

              From 125f00689b2cad67214ded459487fd6652565cc2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 17:49:20 +0800 Subject: [PATCH 851/913] =?UTF-8?q?=E6=8A=8A=E7=BB=84=E7=BB=87=E6=9C=AA?= =?UTF-8?q?=E8=AF=BB=E6=B6=88=E6=81=AF=E5=8A=A0=E5=85=A5=E9=93=83=E9=93=9B?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d89f2f57a..a74c20751 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -345,7 +345,8 @@ class User < Principal user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count end # 查询指派给我的缺陷记录 From b7f1177938198fcf63eadb7732ba1b73f064311b Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 18:11:16 +0800 Subject: [PATCH 852/913] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E5=88=A0=E9=99=A4=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=BF=87=E6=9D=A5=E7=9A=84=E5=B8=96=E5=AD=90=E6=8A=A5404?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B2.=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=9A=84=E7=8A=B6=E6=80=81=E8=83=BD=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 ++ app/helpers/users_helper.rb | 3 ++- app/views/organizations/_org_subfield_message.html.erb | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 22b58fe49..12f112345 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -192,11 +192,13 @@ class UsersController < ApplicationController forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0) + org_querys = OrgMessage.where("user_id=? and viewed=0", user) if User.current.id == @user.id course_querys.update_all(:viewed => true) forge_querys.update_all(:viewed => true) user_querys.update_all(:viewed => true) forum_querys.update_all(:viewed => true) + org_querys.update_all(:viewed => true) end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index bfc01a102..4edfed578 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -89,10 +89,11 @@ module UsersHelper def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count + org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count at_count = user.at_messages.where(viewed: false).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count end def user_mail_notification_options(user) diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index a14138903..5feed27f2 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -57,8 +57,10 @@ ) if activity.org_subfield_editable_by?(User.current) %>
            • - <%= delete_link( + <%= link_to( + l(:button_delete), {:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id}, + :method => 'post', :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink' ) if activity.org_subfield_editable_by?(User.current) %> From 265359cd74c7253e22379ca7e11fd9de25d1bef8 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 18:17:27 +0800 Subject: [PATCH 853/913] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E4=BD=9C=E4=B8=9A=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_homework_type_notice.html.erb | 13 +++ app/views/users/_user_group_attr.html.erb | 2 +- .../users/_user_homework_attachment.html.erb | 10 +- app/views/users/_user_homework_form.html.erb | 14 ++- .../users/_user_journalsformessage.html.erb | 2 +- public/images/hwork_icon.png | Bin 10436 -> 10537 bytes public/javascripts/homework.js | 104 +++++++++++++++--- public/stylesheets/new_user.css | 4 + public/stylesheets/public.css | 4 + 9 files changed, 127 insertions(+), 26 deletions(-) create mode 100644 app/views/users/_homework_type_notice.html.erb diff --git a/app/views/users/_homework_type_notice.html.erb b/app/views/users/_homework_type_notice.html.erb new file mode 100644 index 000000000..4dda65e49 --- /dev/null +++ b/app/views/users/_homework_type_notice.html.erb @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index a815d85e7..48c303a29 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -16,7 +16,7 @@

              提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。

            • 取消 diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 5f4cb4a8e..673cee0e1 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -72,11 +72,15 @@ 上传附件 <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - +
              + 编程 + +
              <% end %> <% if defined?(has_group) && has_group %> - 分组 +
              + 分组 +
              <% end %>
              diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 4082854da..cc7e4bb8e 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -9,9 +9,11 @@ } else { $("#anonymous_comment").attr('checked',false); } - $("#BluePopupBox a.BlueCirBtn").click(); + <% if edit_mode && homework.is_program_homework? %> + $("#BluePopupBox a.BlueCirBtn").click(); + <% end %> <% if edit_mode && homework.is_group_homework? %> - $("#GroupPopupBox a.group_btn").click(); + $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); function checked_val() { @@ -141,4 +143,10 @@ \ No newline at end of file +
              + +<% unless edit_mode %> + +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index d7247621a..b377f445c 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -42,7 +42,7 @@ <% if activity.user == User.current || User.current.admin?%>
                -
              • +
                • <%= link_to(l(:label_bid_respond_delete), diff --git a/public/images/hwork_icon.png b/public/images/hwork_icon.png index 8ae87460fd13f21c15c187d31792b29d6d0ae6dd..f531c3d4c4c2881b535f5eabf341d5c071102b70 100644 GIT binary patch delta 9339 zcmZ{pRZtwjwyt9Y4>CBxHMmP~8<@c*_#nZ8hu|^{AxLl;T!Rc6Jh;2NJHegc&Rq7b za~{sa?yBxp)!nQ6rK{`v|J9{ls8J4lWymKe%`40Wl#>wS8|CS5Se#P~_7s&j#O|;a` zE*ch=AI<;!1+xDw7tZlo8g@)m67k{%Lpn%SO3P#6FdaSZ{ikZ=NprP}tLimdztRPLb!dovm6V>uFP(0SYljtKQDtljrBk2EmRTgl2FLu_H|llW_+$8;-R0^mS@JtV|pQCgQGbD2-AO&%mBBMWH9A))7~0dW!uhE16Q5-$UqX_){Tg*(g4cl9!|^=@)^s|5`K z4vj<%pT3ZOHftn*nBb0ZA2V>%Zipgq!9yq$#ygG?>%@wF6Ne>+amkZ%*uAVfWwDq)s^Zq7Ln#E!x-f${;kuG&A-(5;kaT?wc%dD4V zI>EEc!mV#U#Uq|_ht%F7jV`G)oaWX{t_R4H@WYxtqtr<(@(K)#lgqYEKsxcvfx41D z{29_J{Q@<_E;IU-IT#veD<Bkr_oE&5DWmo^xC)| zKuMEp8qLiD68$+;+8W;Oq4-Nns4Z~ha+#7WGCb$eH6FE4SMYY7C0kdtBi<@nIP_eF z`tVb;J*CT*Kl5MSOL7Fbw)<_kZiW^J9#%?&`TFK``d@z}+=Lkfcf`ep6*avrk#k?Z z6cjxo3L6H4AYmirN3sy;>1PNNR^M^3-}sa*Z?@YwWHBo<&yZG>?9d>6=bmD7S318};>f1BKpog;L}AMMKZj!**_U@sFz7!x7KJx`c~~ zW>4ff;k5#(T)H~RQ@nEw<`2IZt7DM9n_-xi>taZk0}Yw(#!tK>nAr02_t=6WJFcv6 zQd8<^n@_pcT!L}wF&gRMc*?FEjXbA+N!)v z3a?~5K+WlbLFuZAS8GcKt0oh;kCS?|07udFl5dY3=A;}4KM`y`r7xb)ogCyw&)e%V zUWXp1nSX?8oF_T;TPWDq;3dNBB`f}@6 z)@W5TtTcnX4r86LC&}=)KSVj4)Z2e+K1aLEQa5OaWlqKYc{jGGQpl{Z|FpoyTHU8I zXCGJ3Q@bm^NrYj|`_~*F-Aeu=+&W@#W|Vys^T5AtaH>K6c*G0af!sTXEmnkNZZ)LKd&;OPxpmE3v8OrhS5x)YLaUE4toGPZs&|B>AbjrxMOkAHS* zM(^|3aJHd<0GjVloa6-Li9lA{Fm9L3!CtxV9^$Ga!(&}f)}?_hJCpzo?XXmHL@xtq z5f?xdInWf?L)N~|eHpTPvirW6$|RTSc-9DpWjR4|uKXri+V-E9pjLnAkN3hhLr_x^ z!;^+?g($#5D$s#yoX65OtGFtZ5x0boJ~g{Xkk< zjWoKcwx2TxgaUvFq)==9v1Bc=SVm=d=_N&dnI=hiXjWyUwNfcrWf)pi7zt%Zt1o<< zmsX`ds^>mi#Rk|+wz5cK z;;}Qu5RW(<9_Bl%Z8ITidAs6cYH!GUAgs%e$ejf5(<-Z*H43L7-N2V zDeNF!^#t)Ak~vy}{;C_joF~b$%24PZY6u#h%;)EBE#7E?iZqP!D?i%y?GnTv)afQj zzH^L9+kE4sa1>v5vkl4e+_gP8ih$)UaTky57+{2`Zp%1_wi99|-yTQHNg$SMbx<~w zoN|(>)Yt^E62Kw`go~FkB_bjcO!3?z>)Xq8j7qmQw4~*~%wSSTJIxA>8ESl6yhwEcuH-u>F#JAj**^8~I#7+@d2s;%>i&3L&D}e?nxIk+66f9V9GctvqjXcF z{?THj&ib7}G)3uW0Z19@YfW!DMe+&$PZx6X6(FoxlJ+pk$x zeiCzSTaU4&uhg-l@9+UrOt2vJJ`6dY9}&YuGQpKx(8poc?ImK(yqJUikOrRQ9^@A? zv6!Qyp^B>?jk;#gpb+zvdDnhZObsTXrcFp33DD3g7hUHJ#8Kt)&4!ePEFOCrm|9h? zsi&$`y@Ux=vz0iQ|NW~<-^+NS;FSV2`^|6&y>}+Dtd*JqwAp@<9TuxHNy)vRs%&|6 z&@ot<*2~Cc!2i*~iOu;OwbRF)sd&`R%CP+JL#iGjPKUK{JjY>_8}EJB&vOQXul8Ys zhQPjJW}Xs6+ou!WoOzv|skHDE>7L9mf|J~tdG+|Qebn(ysQrBWGD^Lcngr>3dbp+>I0OTtvBJF&&AR)~HJ(DA zXlqf#y9tr-I6*_Os<*K_-Ws;_+D^y7DV}LK*=xNRFUsM=APm7xpjg<}NZsnVbFeJ^ z#3vR@8cCfRyW~~Tdn;>{4EW$FyovDg^{hf1AD@*7x>R)`cjFYg?!7U&{^hD}gDOO^ zvgiNoZHBI7(_Lp4<-^pO#ms5yEo5XqGr6v-jAQ2SO|q=6THXE0X>;taIdUW&aqoV` zk+(lDY?{3155vfb^)ZOiqZ4BQYfg3e_U>Mf;YMuHayPGM@u#~S+gVde?IjBFK~!e_ zxv*@ZW-`r=ik|lLLsP%R&;)hO>D}Kgiff#jr2W&j9Qqo$OQ9E+7U{2vYLPFt!44~C z?W9UL#>R>bLW5JhuiV6hdjtjlE2DaW{*wMpG_K?;diVho4*UlhK1{EX?83cd(f#m& z7ar3Y=;2S^^9UYjWuEh{cX0k?Oo-yuI|mL+dRZSdbr ziNP%R=pXlo9A3Q>7~lDw$1KM}BEqd9#`$S*W~RQe7$bJ`+ek}ia-F;rzrVBD+h%d$ z(2nAev!k?AY~1%s{~;5;bZTujD&1)OXz2kVHN#S;6S^)ewFc2>8Ri-qj@xVs(^j26+VETnt+t&l z&2?K)G16zVZ4BbVI-wg)Q;!hG|ESTKY}s+1?YkV30bsxpM)lnKeAd=I6$UP^5mV=k_{VLhhVU2dF%p9?ic>} zjsw6OXJFc{i*V%mim)5Gj?P5bL9eF;(t_%}b$^f8D! zlGd9%=JJv&0COV-1Yj~$FNSUhVUw%mY(JReOQn5kI3TRGUAnZ(*|PCEeY`#2wlD44 z!Fl&>hXYcigd>{g)R_hvbhaSbTYm>Y`-1u%nuK|Z3e6Ahi8VlT;4*!fOHuVl`|>() z2D2Yiz8CLg{P`8zvOLx&d5J3pz#d<~O&RE)#m`$<-@^1S&9?#$OE+awxHaFzZe=C1 zbUvtiU> z3-3ivs)*Qo%1ODoxjh-km`w_X26mu|&O%qphXBc1s05lB*17{YO>UEac5)~8GTmHV zpFdn!&$7$sL4WESg#BV>j)XdZ8hstb94XIxMEv*SkX6L!dgHQ%R5f;CU-{3&*KRQl zw7)1Vt1Jk+Y#e)2FESD2*q^sZ{OkIW&0kSuE?^=mf9J^O7)cVo;eub zD;L3e4V$pA{syxssDyp0+?9d8BYV7+nvDV#EbkUg5kbGD z#J}FJViw7#X#Gfq7IFNqVA`y!`BM>H5>ES0fCrOCXR zXvGtuqp?~im^o?;kTabeG!rWmCZ2v4E1gn2Vre&4UQqTD39vTx&)M;s#lF%)tqUIH zO#fc7Jj~<$Y(&O!Y1o&aSsT!*10vVVwu{$Q)`z+u^J=Tggd^pa-$>-{8$dy0~U>*?R+KcW6+!E}&uBf=ZXvQbC9PZ;*i+K*L%)${$Yo&K1Gf9k<;D9uSkK zcZpgq?ydOU2vhe_wsLJq2D&d{NmL}xA~0{TRj*?9?1pGLhY;0sNzv(?Q=0NF^uojr zDuV$b*bB43t?oG}4NVY?!v;mF%wS+=4EJ`10MCYsFNI>25{u@I6E4yHuU++xB;5q( zVK}#*CR`Fq(xNFZ;9qe`;12)*+z%J+KM`gNVSdXk>t%BU%rkGx=DJfR@i2=t>``{g z1EVC|e8^7|rJy#J(NM4JW8JnQ&2y#N=^%TM?5;E2PS^61dDg1l|N3T=LT?Wfg{>w# z#$XO#9j7ku-e{V73nc-GZ-1E%$9K48N_3 zbj}NY+<=QrH|qoKu9-@xk(n1vD=>XCl@EKgD)h0gL#&%gad_kfQ~Xj>gnTHF`yv*? zxO!jUo3Kz9X~aNKOk7?Zc(#WzNa}mrRy7mZoq7CbGfZjA+C2u_qT(3FoH@myik+Z< zP#m-&$|0Mg1MKDD5LQyK{&dkuDYQTzT(a67BV&{(eOPjRDY(=Sgh%Yu2{XwcE`gh# z8q}9YitJuq^%WS8*k~aZYPg5!JT0dsGkhNGAiPJ%FWnwh?Y1V;J6e0+#M2B9P6Z$QvK)OvozZVXGZp2JbV{5Wv;E3fa=xqO4iz(yQ zOJGN{a4J8|S+QgC7K0bas~G-ls{}OueO?=vWWz&wTCBHVLdC3LSW^M3ojIprbvCBC z>_cAMl4+6zxdRDA;ztCqNit@=b}H9u;R6phNGZ2iT@8+!x)%S8IjX8<@Z z2`cQF*t2ih`{yMiXU4E0JfbDdO*x@4`dZ7daLP~fWjuZm{C0XzG153_ z8yexqr^}Zz-(ObLmP%V+ty1tc7C+>5jm1Zvvsq@+Jq*dyaj(K8t%qforTXd#zh_9g zu>Vu%+3t_x-fSs_pO(GmBgp$(J@ovwVKOWt$eJ-Zb^zDMwy2`pa%-AJ2q!GCqqL8` zfqxTA5dIk8*V2l!oxpCe4K5^d;t*}9gNb=x{XPa~cH!;FuOQogP^6JJywJ#xRMo#oAUhkVRbN~JuRRsSr2$iW;M2X0?l5$k z%0DN-kK2hQCC=_Tt90>aJ`Tq3xt&n~1I*nj4t*=%Y$m1<74JlhG=u~;MPfzu^;vQI z?*r_aw%>er1e0F6e(;>Eq|64A5eJS>F;5H=l;C#M`TuGS7QH@Y3D(Y2+H%ldnrBxG zraW$bbf)O!OKR^nCdFJeB>xW!!X}hkPK-UikWkCY;vKLwj0IZgUF+tFjh}}~WVZ<> zNUG*R-R+nD>@C$hZ;R?x{|%nF+$E@r=*uB_PjQQb-j1b?QEgd*Ws9~hI7p+>P#z@- z0oF)^Jt+bw-tJSKfaqgqn_RG{2ydRKp4q^|Zn`(7q3PF$Whqm#H{*Qautd+puQLs< z2P5dOPGUP3+PMTZjpuT8T#x^Hu0+k2LKb(mh_n8qDnZiG{RLN|}IBT#FLT4}U9Ohqe-E zJ2JbIExMIv@Y`;u6kWz3Dq2jfylE(t)#w>KExWu1J*HtnmZK^2j96xc*7_2=jk`an zeVj?&vZ5O)tO&&m7%75cem3)-2#t8}3?)BK7rm3{8wcX|mvNIG-;lTD1t%B=#)Q8@ zUb2}o+M+OG(=Aw6_;dzgzk$O-s7Gi=(+t@NTF5&mYa;9@wul{FK%ZJ^sPPL=^hMKl zxwumfP6O3H|Ii+tZCNBYFUjUgU!BrFn_O79qh=qW{e?}S&q>euoRdnLg9+?(ckYC{Y6nQ6?~Cc6u!cQ4jaSu*ZQ5X zACHY1eROmL=-^@_9APEEu$ov`iy%QvSv52?Sngli2{e9LZGpZ^xnKqn{~#G!SXf{j zI|D&XA`VUY%Q4JX=?3A;HSQ-yI|?vok_CH>fm*7gbD?Z`vY>HEObDJXvEoPT=uQ`> z+^A?o--vSlB&N*}p2OcXSXuVg;(ZOCE~LX*cplZu%L_>58Wn!zbvaO7+0#^EULn8# z^BI{KD~~G$=1Cpz<90mZQK9l0$O79!$dqFh{p6>NnRovZuGJ;x4HYRt%TXXo;owVc zyh%j4Rh0%I*A?!(b|w004YJ1mUiA$WG%dyxnmu^unRWq1idn#P)`{;M>5pJKB_8YT zKkOs^Jb+pm(Kc8HkkX)aLz|o`YpCk{(_>6rSkRqed#*Vp$}Sl)!6l7jVOb2@h!9t9j3Z9`>> zOEGR`^ncSYj=Y0$!WO6lZeF*iK_Z;!^I7-Ld>0ubNqH?9A}Dq?ztwj~L`1OOw}$k< zG4-(HRv8pR#7!O@;^JxxOZA?(XYSwQmaSIIM1O3LS*ot8a^_%f)`_Wps-NkJer!Q% zS0c>s2Ws|8cLrL%8ss?#of$@Y$VK{&l00&AGzTa<*(o%pz8_ZWy^~@`^T#RD$+wSt5mCfYHnekYX6>nobfdnv zdVIjCw41+rKkv=zL@B=nQacp#`5hKaagFstHGjr!-xUX-MA z;|UE~`;3b42RHpIvEUL8jCLRAu6?c~Fyf;hL3w8C zT!+Tf4EGH`c10~Y3*nKKtE+36inwRL{qnL{z3YLXPe2eIY+~_4zFORP<<(W>zJK_A zpO$eFgGW9r)@ntaji?rX$f5(+AV;C5E+cWs(wQGydIxdoE3Hs)~N)jTK*u zXt`-;P}rWdvHX$1et-Vc=VfF*YSD2FZ$Z=pc(t4^=r&J_$CEgH$_9aK0sG2JbB_7u^NqY50y%<^Hy^S`H6_|)*v=}W}37DMr&){6;?6H93+ zJf0J=I~lOQI4gDpsW7u5Li$DJW%kUHi+f%$LmB}YfusHda_H+E7GV*mN*}%gry`A?i zC*zbY#dA$X{?-5Y6{TOGKf8<1<4bx;_!<)jY)m4>=rnxmb48s{jKWaPC(gvd$I_M- zUx^e)$#jsLpIxWzTk|Y6-B>U}yg-#BSt&B#qIpFH*L|F}IPQ*83Igvp&p>IF(FfMR z58Wz>`x=T)vtFx+IojIt%16HUWY{s(`So>uxWU(tBaSc9&Sw7aB4ie_Ej03Iq8sY~ zQ;RxmG{277lg6Wnf6HR@uA;f3zW%oN&FO&!E*0I0XxK00vuEYq!8OI;cinT(2MwAq<^K77Dfd^6_p@U3gzmBx)|Mgq=0amG$F4Tq42XX{1-+7;;a zL$iKWfpKG#WFD(3EJdkyGzsi;Yzj4p5yO0?4Z(w&iis)qupdOKfWG_P zIocAYjSaE_s%E%JOL8Pq5!*ZGka#bz+wD~{$HJ^iO<8vTyFg6}{P35beQ!h9XBY$K zNUl-(E1^W*uGQW)at%To?Q<*|PIu+vv1?1fu<6IhWMD=^WWrWwgn`fMEHy9eQPhjn zb7O;Kf+AKmPcgNGdeU`w<`c%|U{ii$<9!u2Hn!#$SJNizQ0tUL4gYg)3>j2m4W{0?E-V%pH^n8e_ElOe ziu3~{{OEV02{+#C@S2D90pYsy@lQ*130yhU9(lV`HQPI7r_`2W)!9N#KA7MAc^1!wjN>=ilYRI3CIX$In(=@7-e(QkIj}@txnx#%Xz}n{syu(QR!x z_{zw61?mSqf57;WS};NF-H&IU_p~kuqiIMVzvz`7YcF_Oa7;sl-Fvb6KueCvney43 z4LO~E0+Zj|@ewkpI?d=X+v92qFI(|>BPKiymT`ye72yntZm{n418`6 z#NoRyC36qwJ|kAbJsj#I#3^#sc;@B`cv4wB?kLx@I&51(&$sH*)s3mY_4IqQxi_dE zbiYzrs86K+~_fMnz!goA}dfUZKD+t*o>f_^k%QWJI#0{`l#4Cx{AZ< zl63xrRys&h%T!}G8X1q(E^SH-uO?9y4T&8VS}V;G&XQC`Px~f{L|hKoIm{WwjEa0i zy)-b@5R!CJPoetuNnCChAQ;`x8-8LIPoBh_^ahg7j(f`1Fkjaqd7(@hA+*&=I1$>* zY~4M_Rv*#B|I15tiBoopv{aJSpEd%xx{($kpnAEtWb{zmvbORkH*Ueu^C>5OCxAfD zQ#Z;z61(f>4~e@9vZ>AFJ-(K=?vG>aiw<-|CNHI~21fBb9m-v5X@8zl}CFqGdZ1YwO$dE@}A(6FE8PqKg7e z{F2y8g%2Nf1o4aTBA999aB{bo9ZlQVk-d@Ytl5ZfTf%QG?n$;$ip+6iB@q2foBylO z`>;e1#lydP{pSh%OSk_S^iSy2jG5Ee;_pQ&^LMI6dX*`q^32rCW23V?dxg_(#8XaA zde>tV_pDDApb4ic`6IjA0pIeV7* z`~R@>h!EWKt!hP8iYU>^sVKp50wg)v2gOnu%XJFjddP%SC@5I7@2pmirwIHd0cm>1 zXiAC`lEM?_rJ86Ni{wLfJ-e{ZII-Ba8T%yQQ2uDXCJ>z(Ui_x8P9x5P3f7$G$WA6lXP& zxfjFROT`}pF3uXq|FoK&Gao1CJQnc!n!|`l zf`Eh(TRUGS_%j)I6>pu1nrUy*#GMMC1Xm|@=w~S}U#k%+X|q1|Xq^cDB4oUi(un~X z@Xp1lGem-OAelzsyPuG&+(tuLD7cV!wO4@9d?<`7@dr+TPtioe9Ku7}_^sioMWuEL zst|UnOR{6>iXt}oO^qSoSqElYe&8r@P&jDt5Gq7nDL8Vr1%$ML}fZECZ zOtl?FBd2-$m<7+k#uJ9V?!E&?tc@%Qo5IO?pf+FUiOJ%RUe^;)pw$QL2$ql!w4c;E zVMZ42dA~>h(ZyC?G>?FmkPG9Kg!1Tbq%JToSaMr2CC$mvH*&*c<%VD48A=&yW6CF$NqrU9KusM%YmC&=h}smFD1V*)0?FoJo8DD`>zd zLa{WQ@LeALvIij^Yk9XC;%GG~nW6hUjG^u@uU6sR&{j_ua46^<&rQh1LwL5!hRtjL z>B8lKQXaohH@;Wd4sAsI%NtFKN6TJ|5bK_(SoThIcq~P0+w6oXSkT&>px}1|U99BR zT|OQ9d{C#@!KyV>%unWcFm)~7Wx#(1%Kjb{rs+1>H`IA-Of~OecH%srD*mSVXt|J! zB1HyDGo57wxPRxM7vr$Be{y$u|Nro+zyH+#^`>z%fbRF2_Su0^8l(nFg;ewR>Wo8S z59Rb$tf3UubKS~eE?XXg?Oh1zU_b9vKl(xB*~$2yYG6;&-1}F8^EcG;#i&cQ@PxBX zyjZh%eHB+VK*`wbXK8ddaBb-lXjVI>_dR)~;yZE0pg#EY?p>_7&o<5!HXJ?orwQ#Y z;5>+2c+N?JSELE{yC8N)Bh}pzvHHR;G=b54?Q?MDQy#c6A*iNR=li`9zlswi_E%9o;Q)(t2Rjq8V|SHUsN8ea^@;ZjP_MmKGsl zs?SZ@?^0+n*^yDT0x<`*!dIUf$s8ZJ@15%%H=m|QEY%ma)-Ph_>@93_Sh_31iyJ12 zkzDOS$!^v@m4}^C>IJ{GXUm9>Y2g5E1X58Q{K!pdKdt&=emJjT7bSqsWN&b@4Mok6 z66dmhoVM=g$Ae>jB*;saEc#4it!>p7q|<1!r6m>d_G2=jw`-Sbi{=ock?3z;%Qb&s z?TJd*Y+LhMe3IzNikA}UHQ5sEj8r=yVQ%0>21kV7z)8e<<9*d@Gl|+a2oC=0B$GSm ztb(9IwNCqNL8ujn*TiE(6aV%8sD^vn>sJQ)@uHyq zcWLQIQqZqBaERIooF8T7uI=7+e%OD+>e0jQ)EBbn&hN4He({At50#<9>zVN}eHf4t zXb#VXdbAD4Q=r$}Y+3JiUyPXchr#dP`V#BMvozt#u}fvBf;Dp~6zJZh_AydT=;OkY z!{EEFW~_&8sYvU#62YB*+swNnn@KEWr6@|o$HjIy*6&rts zzC`MStezI;8CD}>&o*ONe~Jj`UsP!7Ygrqq2bYi8A*N>BRm|ks=~g)vfeat*UFQmA zdrYYP_-R~Qrn|gX)8`-_of{9be4W9-O2gA(@Tjnlw#K{0ziU6M=nZ;GH_JZXvIo_lf(X_^pg`i5oi|r8PE6pRspz84Tk)HAL%qrRy zRoew*CM$JaUEy*4PS)69byKF0tFxbQ(`}VkJdo@L-{osI4axxSgT=*NuXeg%Oq^Mc z>gDctAK(*l4*)sy-neJ77gYw|yGeLOnJc)oH7%^8U0JyOzm>@QMH>liQ5=IP^J@bb zi*?28Z6W>s3iSj9C#riH9CnV7A!Adt&g4q z73TXGpGqi|;7wvFOMjSeoa#lS-VO@v#LED8)7p^Kdn0bndrDB80+(DAa~Ll)w1@Oe zR~ic{vbIKg{NgSKc%7z)7Nj5c!zI9YyAC~*Y@}E;)>&tx8|>DcTt&rBmCQt4W1a}8 z=ZX9933~U%QZ(tC4T$J=qG zQ`{Gfifi`4WbiA_h|K+ZcsC`&b4)$#l&MEKWNRtL^*Cw9N{A_P`84qEdZs!MnO${< zmjV%lElTaGO-f26C>2&!0>9%EgAea4FgsHbGh$AQ+UNY}A--mj17g&Z2ZzKd=)(GG zNYe3rBk>>g@tb}#oaSxUuN+GRj>aMKX#OyZb0WWulQL$}(M-N98zwQ%Bv-KTB*!Lg zwOF{=Z;BmR{c(wbw}xd8ildzM@Wsa`pC_zy9LFwxnO!}7Ke{(p2c*rbTRPZao~vM$ zh{WB9VPK+<@+tgQpda`Bc4+EI>C&~9{cf{_J*FoI7-H6iky#vKyfz+RiO_`U>NQzK zQ&w3_Z*#|y;_!~Oj@iLi+WrA?GJCx&PT4Xz@v=8thxS*CDgB>U8LM-IJ$eusCy6KP zFH~$LRLc)}R_Rr;f#E3|ksc|f^0zyOqwg8q%#;lGr?9+@T7$FrJro|B4wV?E-V}VB zG9da`5@zv^xItHG%n>(iX7kC$iO|@#@+%l1=zm(_I{EHp<2Ih>^Ub8ySng2cAKkh3 zH{`EzB{>Ukj6;Ny_MGW=GcBHwAC*QC_n2!{2X2(Z?*&HP zSzFJ4UHctRPoIW=FCH$|fxqwtua9R)5Ay0#z*h)XaqP*11C#LnJoYGw=trI-u;6>$?(_rbBA&<8vm-&;K=`T!$^F%VSZ$5K29q>@oxPPpxmD@y$+M z9~!adkv!bqZZc8v18A~myQPV)=iRb6#}p^Al|p<$bL}sRL+P{Nf$LqnK`jzotIAr& zt(mDb)lG`HbS>Y{HeVMRZK*19@#24~Bl!Uid(9J%n`%@JCOVJVx*k%FoBnil(x%m; zy30}qZ=VuNy3GrQJN$8{H(kgCvlIwqfvW{|)ET&7Zyl}_fpUVRbJPQZ;t3Ncnc?F>*mjudQqULVIZr+&%UF*`lG`7>I67^D5l>8 z(cA~hv#R1Dc<%4MBBidpppPi9imW!5m#F~@G}jlEUYuCJZlHy$FWYq!cEwdAg1=6i zBD8X{duDZj2c9%@+mmGEiR+f}tsjuXj91i^DE2hF(aR4KP3P=?xmXp7UP@OgcHv0H z)#s{Qf~yNINC8ru8}TP!3H?^P>)$^Q=IKY(Jwz)z*`r?+Uq$6_;Ua=#%w}FP?jDw^ zrq;BuKq`ZN#&6gT@T@*dx-&JqFg3c4{&|y_TA~m5W|y-5{&ZiZH$W}&q2!MLpvUYm z>6+iIMYrXzBxmG>$_~|6Qrs}70v2aKtBOsp&HQ55Lho5++i>E$2s3lVT@4s1&I*40 zJ^{k1oV2wNT0wk25X+oy{ZTX_SQV%yZ~|pP2UB5UD<;rw@OG~DQX^E(tBMo&phj* zH$5@Gc3M(8^e@_>Wo0l`0D0%Zl#;iSGL$uSF9b}11-|vB`c+2okI-X#^PKS3LweLc zPlFAle=-{*lPI$mvF$1$;6iRytTqJxU2Y$!6EORTNBed-t~Isy>sC&cNFPI7x(Yyd zH2Sr$*NTb)lAf<*UirbEZ^To#zNOYu$^9Kd&;D>OKrGAt6{=i zk-15(6Z55J!HoBTA=_L55ynG6RNSC0^%{(`%C7{Sb_Eig%BVOY?YCZW8Da8h?O1jK z+RsTj3g1i&r;Q)6vVMHJcrE$J<<_09LLkTfe63#*WoT?C(GP)dlm}LOM(7oP`!`ho?|=f|GfE znE2Gjdyp5AxrQLVWZi7q)hB9_+iZyyphCn$MV{P^KGE^588<39dNxPJlvqw%T6?si z+6f{J&$N@P`69=xQ{_y-YQtKj26eWiAi**D;hWFLTuyp;$7T9?k;$7j#_LY)qL9_^ zwIO{rE2op;C&y|Kysti>Vs^$$JW-wXO`ux`5~)gT)HzvFpW9CNa~x_<=}nggB>9=u z%Y+pjuK70|6wg2tom)Oml@2sOtZRZ31XEDpQx&xlLcQ2`Q?oar{ z@G;_)5fBSvmEpjiXUd5TvWaS8xbPDA@9i*B{oPpYdpIk2@CKiUD>nb#jBGU6Mx6@e z7uk=bmS$1)r;^MVRxexTje4)q752oLxfc8HUeqJYD3;&LgHYy%uSCX=a=>^hL2;TE zzOFp5+j~+VOWe-iIeqM{6Nv0%oXNHowzO0Xz2ByaN<{SIohvPAzb|rFeD`6$SlD5$ zERTWvj8ZZY6{o^fyFYq!Ojy166u5IX!OVQCbnL@oQo{}Ehi3+P0s?-+j%}Xn0{T@m;7FPkQDo`nv6i|Z z;vR0?AEY3~N%5i4WwA+EWm`TAFP`IIc_@RQSAQQiyLsKG2=Z@<@o>PU^>QkDp5>u! z$0&P64Eunal|= z)|R=QZjQ}hd7}&N93Q?3Gn3E2z$GiUJjPB4kq`^@B7OCGAKJM^7VY*D#dt6 z90yCM#%e3l;TtU?`AdHxln(#UUw$8-wr4BR5pKvW-O+-b(@P^bvc6gGc#TX~!qexF zI%`)+m8ZYkoB~gyoG_A;31^(W4LHngccP$`lY6%Nx@j~FiYA;*<^6H2BANGHFkDI_ zKk%%|tZrjSxX$jb)V7llx-;gm(brc%@pAtv^y6DdvTUU;XD4OI`MyeIGKVv>W*W@2 zI=LxW#(@|UPssSZ)X7{jJpO6G9bvhCwM5Its*<+ZDCEG*LM6mr`QlMLH85aQYuWum z`e&f!SMP*rqa8fsp|XB)G1S%e(fXikJ`q}h{QWitq$>Dd1ZWgCy?8_+O{<&r^3UQw z^tviAsN!qJxSTFpW;!BmCY&wy?mbCqNE4_w0A;SNN3iF!WbFu@9(!6GQc&O%^(9>P@EIcMvFfaOy#9rRqYU_R zG4k{c@oRc@2|T>$6-?K-T)u__ItOgwZm~cB!Ep)%z9JgFhPbBt# zXb_XQUfbq*c}aJWsaZ(kXWMl-=sOi*I}Buv(G`j&Aes9|w3x@O5x zRTmU0buAex{SWwgo=e9GWGUUg(f-vV_=lgjeof?)4#{~*&Bv57@^rpWTZP?B<$9I$ z>DQDYLNGB8NU6cK^i$OABLr!(dCMTv)b+?nfrcayI^2n~_AU97mSfqRs#*CaOquK~ zr$a@e<-D)+E_5pI|3kc(!+Wi1WU74^xYqNz0Nox!g8RUPs-)F z7n`{=8_I~COL3_B3hD+>ceKbl-7Lvc7Lqtm-v+(yAUm5TmJjiz+6+);0v9E-{_?|_ zQ+)65uQ;_Lwxr^hdb5w`m+e;=d|?)H;bFwTI7+2r0Ru3JH{Z{0nqT%hls77ds~q~I zm~&1pmoi6EQ&W>kXANHt{(wVfUq!(y20oiY&(ldEX}ml&iyYG(WW=|EiE z$j0>aujP`d<2M4CJ6*ZF>d)oJLS-V|ur7N~-h*4(O&tP}Kdgv80FB;)FO< zpqj}kO7=~R_@7ri6P$Xfl2Ce$n}{<1R^aGP7a?04&W*(NjY7O?V{o8ES zG6(r2Oaz4O-Ax~nEe0)XU}OWeTR$*H8pm|62-ja0L=Trd>pJYs5rXe6zn*WDI{oz! zANZptjv)CW&uT38Fg`%FAJsqUN~w{lEZ{wQfN%Y#Z%Mw_RH}E;^jK8%(JLl_L$JZM zv0M9`!}Dxh!j`$(bDI;^s>bDk9g{{A7aeWwi7N*$orN|O(YNKE8dM$zZGSQL5dXNk z@^i)R+|_Mbj?>$qkKIKzgaS%iM8rXK_lWvdCysQk4P z?kM#YfZS-;NmJ;pkC&%smD#u7TX&K!3$yY}Gd8O|u~ZTk9pBIy8I5W93>K66{Z#7vC5MC)N%dBLifW;9>`}-Cw2X51%^PiDbnu9f|a1NO2bIPx7`w=I9 zYqwh}!zsA)G4rOs)FZ7uJdR087BlEc0|lNI$P7!*>-p&~orMk-GHGKShd#V|I?45P zSrPaSInvX{ZK{$UNtdWxpsF-I8&8=e*`A)B9(;YKopy5889~?{F~0+1m4`}G3R%Yh zr3_~_jGQX3o+}@9)V+S|j!Q?wh5cb?k%2hsPhL=i>sg<@R*-(;w0}iHy91?+Gh=b`_`tPqe<4E5#bN z1+15_uHLQFR)aHE*#^tl`wZj}f8BWjSoa5=h5lT{IxbaN5<6XbPi}hNt@GOJ+^rYn zVOMJ4nObe&XIN`+4PB>ud>k%C5;5mTqL9|a^i}*xr|Of9m_Ply2`$`DLYl&7m+`r6 zrl}|?$*6r6Rz%$!m#(8z$|aOL6BUQO2Uz)R>MQE%%8|6I5y5wVFZ6Wi}wcMP$ zx|_a&_^Abk5^b6bOt6LG)8oZ$ogFigQUR4BP6V59RMKaf8Gi$&>P)4Xo3z*Hx}u_s zEUP#}U&X(Uxmm{V#GzCSDTo8oB@cTXvqM`pGMrAo6|@F!T41?S{O}(?iOI@j0wP6r zLBtT&AqlC_r8I|Sa(nZ^Z*Hr%n$@%pkphYNx^LubB*zCOA^CR{_`IOcTxhD%kr^}e z@23rmc&okfcO^O^i%JPJmFxJyc9vAX`wTtvb9p)m9(A3olD{;xYMmyYW1A_MZ;`CHdt3>HDQ)8**7SQVkWjv6jxzXiqjN_^WbU4!yC?!CbrDsHmsoL6K#Z=wNFy3%CyI*l((m+ z!9Rje^0*~^|93ie#W~Ps2SG%2B752C z*@44qY$&Zu!EZlCb{auWF_gc*$-Cbkp>ex(eZ3C~;~q5(mRlDeoox1luRc}voE@a@ z$!U33B_9!oW_bhb7+A@~5!P{sTbAqC3ig8wB5LD&j81@w_Un|Uh_^Wky?2dqvgMR~ zlVISce zI&q|BE=*2Zf8eN?4FD*@1+`hIUGv|Bp?WDPDZvfp+oZ}9`uzp%1e>QQZ^@~sw)7YDTTx6{+e1LIeg@Eu=qV-&Pu(sB zE)jkH?Wg{lNwC;pX~_55fYl?6ot-2`(p9M>Hv|4fzkM1wrTl diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index bd2b967e4..f652d0ce8 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -106,7 +106,46 @@ $(function(){ $('a.pic_date').on('click', function(){ $(this).parent().prev().first().focus(); }) - + + $("#NoticePopupBox").dialog({ + modal: true, + autoOpen: false, + dialogClass: 'BluePopupBox', + minWidth: 500 + }); + $('#NoticePopupBox').parent().resizable("disable"); + $('#NoticePopupBox').parent().removeClass("ui-state-disabled"); + $('#NoticePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); + $('a#switch_type').live('click', function(){ + if($("input[name=homework_type]").val() == "3"){ + $("#NoticePopupBox" ).dialog("close"); + $("input[name=homework_type]").val(1); + $('span.group_detail_info').text(''); + $("#group_setting a").removeClass("fontBlue2"); + $("#BluePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#BluePopupBox" ).dialog("close"); + }); + $('#textarea_input_test').focus(); + } else if($("input[name=homework_type]").val() == "2") { + $("#NoticePopupBox" ).dialog("close"); + $("input[name=homework_type]").val(1); + $('span.program_detail_info').text(""); + $("span.program_detail_info").removeClass("fontBlue2"); + $("#program_setting a").removeClass("fontBlue2"); + $("#GroupPopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.popClose").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $("#cancel_group").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $('#min_num').focus(); + } + }); + $("#BluePopupBox").dialog({ modal: true, @@ -120,12 +159,25 @@ $(function(){ $('#BluePopupBox').parent().css("position","fixed"); $('a.ProBtn').live('click', function(){ - $("#BluePopupBox").dialog("open"); - $(".ui-dialog-titlebar").hide(); - $("a.CloseBtn").on('click', function(){ - $("#BluePopupBox" ).dialog("close"); - }); - $('#textarea_input_test').focus(); + if($("input[name=homework_type]").val() == "3"){ + $("#NoticePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#cancel_switch").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#switch_homework_type_notice").text("您的作业类型将改为“分组作业”,并且您的编程设置将被清除。请问是否继续?"); + } + else { + $("#BluePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#BluePopupBox" ).dialog("close"); + }); + $('#textarea_input_test').focus(); + } }); var saveProgramAnswers = function() { @@ -162,7 +214,9 @@ $(function(){ if (valid) { $("input[name=homework_type]").val(2); - $('span.program_detail_info').text('('+language+','+test_numbers/2+'组测试)'); + $('span.program_detail_info').text('('+language+'语言,'+test_numbers/2+'组测试)'); + $("span.program_detail_info").addClass("fontBlue2"); + $("#program_setting a").addClass("fontBlue2"); //保存js值 var data = { language_type: $('select.language_type').val(), @@ -213,15 +267,28 @@ $(function(){ $('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.groupBtn').live('click', function(){ - $("#GroupPopupBox").dialog("open"); - $(".ui-dialog-titlebar").hide(); - $("a.popClose").on('click', function(){ - $("#GroupPopupBox" ).dialog("close"); - }); - $("#cancel_group").on('click', function(){ - $("#GroupPopupBox" ).dialog("close"); - }); - $('#min_num').focus(); + if($("input[name=homework_type]").val() == "2"){ + $("#NoticePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#cancel_switch").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#switch_homework_type_notice").text("您的作业类型将改为“编程作业”,并且您的分组设置将被清除。请问是否继续?"); + } + else { + $("#GroupPopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.popClose").on('click', function () { + $("#GroupPopupBox").dialog("close"); + }); + $("#cancel_group").on('click', function () { + $("#GroupPopupBox").dialog("close"); + }); + $('#min_num').focus(); + } }); var saveGroupAttr = function() { @@ -245,6 +312,7 @@ $(function(){ if (valid) { $("input[name=homework_type]").val(3); $('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人'); + $("#group_setting a").addClass("fontBlue2"); //保存js值 var data = { base_on_project: base_on_project, @@ -259,7 +327,7 @@ $(function(){ return valid; }; - $("#GroupPopupBox a.group_btn").live('click', function(){ + $("#GroupPopupBox a.group_save_btn").live('click', function(){ if(saveGroupAttr()){ if($( "#GroupPopupBox" ).dialog( "isOpen" )){ $("#GroupPopupBox").dialog( "close" ); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index d31c1ee0c..62987c167 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -195,6 +195,7 @@ a.c_green{ color:#28be6c;} .fontBlue {color:#3498db;} a.underline {text-decoration:underline;} a.fontBlue {color:#297fb8;} +.fontBlue2 {color:#269ac9 !important;} a.fontGrey {color:#cecece;} a.fontGrey2 {color:#888888;} a.linkOrange {color:#ff7143;} @@ -1456,3 +1457,6 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} .subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} + +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index be9d51799..0eb1cf112 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -225,6 +225,7 @@ a.c_green{ color:#28be6c;} .fontGrey3 {color:#484848;} .fontGrey4{color:#999999;} .fontBlue {color:#3498db;} +.fontBlue2 {color:#269ac9 !important;} a.underline {text-decoration:underline;} a.fontBlue {color:#297fb8;} a.fontGrey {color:#cecece;} @@ -1040,3 +1041,6 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;} .subjectContent {color:#888888; line-height:18px; font-size:12px;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} .subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} + +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} From 7b56dc7f8eaef447620827479fb6eb83874bd379 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 18:43:14 +0800 Subject: [PATCH 854/913] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E8=A7=A3=E5=86=B3=E7=BC=96=E8=BE=91=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 550642120..18d8905db 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do end end member do + get 'edit' get 'setting'#, :action => 'settings', :as => 'settings' get 'clear_org_avatar_temp' put 'set_homepage' From 82fb50ccd207d03c990d1f20fecbabe058dde3e8 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 19:22:10 +0800 Subject: [PATCH 855/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E4=BD=9C=E4=B8=9A=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/member.rb | 9 +++++++-- app/views/courses/_show_member_score.html.erb | 2 +- app/views/homework_common/_homework_search_form.html.erb | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/member.rb b/app/models/member.rb index ed7ee81e6..413fedc07 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -150,7 +150,7 @@ class Member < ActiveRecord::Base #当前学生在指定作业内的得分 def homework_common_score homework_common - StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) + StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) end def student_work_score_avg @@ -158,7 +158,12 @@ class Member < ActiveRecord::Base end def student_work_score_sum - StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f + sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = #{self.course_id} + AND student_works.user_id = #{self.user_id}" + score = StudentWork.find_by_sql(sql_select) end protected diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index 2d08e853e..612f408d7 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -28,7 +28,7 @@
                • <% end %> -
                • 作业积分(总分)<%= @member_score.student_work_score_sum %>
                • +
                • 作业积分(总分)<%= (@member_score.student_work_score_sum).first.score %>
              diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb index aa3eef59e..f71cec9a5 100644 --- a/app/views/homework_common/_homework_search_form.html.erb +++ b/app/views/homework_common/_homework_search_form.html.erb @@ -1,6 +1,6 @@ <%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id), :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> - + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> <% end %> \ No newline at end of file From 1b5cdbe62861f3023ad9a7cdf7046580a7dd4fd2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jan 2016 19:41:47 +0800 Subject: [PATCH 856/913] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E7=9A=84=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=AF=BE=E7=A8=8B=EF=BC=8C=E7=82=B9=E5=87=BB=E2=80=9C?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E2=80=9D=E8=BF=94=E5=9B=9E403=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E2=80=9C=E4=BD=9C=E4=B8=9A=E2=80=9D=E4=B9=9F?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=BF=94=E5=9B=9E403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 398b385a4..a891d3354 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -344,7 +344,7 @@ class HomeworkCommonController < ApplicationController #当前用户是不是课程的成员 def member_of_course - render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin? + render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) From 50bac16d7c27803367b13ad458470c9e71c2cd13 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 29 Jan 2016 20:05:04 +0800 Subject: [PATCH 857/913] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=AD=90=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E7=94=B3=E8=AF=B7=E4=BF=A1=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/setting.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index a91a079ef..f2e4d5631 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -58,7 +58,7 @@
              http:// .trustie.net申请 - <% if @organization.domain.present? %> + <% if @organization.domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == @organization.domain %> (已批准) <% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %> (您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准) From bb0ff4a14cdb8da8d3bc028472d5f966b0367b29 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 Jan 2016 20:31:25 +0800 Subject: [PATCH 858/913] =?UTF-8?q?elasticsearch=E5=9C=A8=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=8E=AF=E5=A2=83=E4=B8=8B=E7=9A=84=E8=A1=A5=E4=B8=81?= =?UTF-8?q?,=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../initializers/elasticsearch_dev_patch.rb | 53 + db/schema.rb | 4115 ++++++++--------- 2 files changed, 2110 insertions(+), 2058 deletions(-) create mode 100644 config/initializers/elasticsearch_dev_patch.rb diff --git a/config/initializers/elasticsearch_dev_patch.rb b/config/initializers/elasticsearch_dev_patch.rb new file mode 100644 index 000000000..4eda95ee5 --- /dev/null +++ b/config/initializers/elasticsearch_dev_patch.rb @@ -0,0 +1,53 @@ +#coding=utf-8 + +# elasticsearch 在开发环境下也要打开,很烦人的 + +if Rails.env.development? + + require 'elasticsearch/model' + module Elasticsearch + module Model + class NoObject + + instance_methods.each do |m| + undef_method(m) unless [:undef_method, :method_missing].include?(m) + end + + def method_missing(method, *args, &block) + puts "NoObject #{method} #{args}" + end + + def NoObject.included(mod) + puts "#{self} included in #{mod}" + end + + def self.extended(mod) + puts "#{self} extended in #{mod}" + end + + def initialize + puts methods + end + end + + def self.included(base) + base.instance_eval do + def settings(a) + end + + def __elasticsearch__ + @__elasticsearch__ ||= NoObject.new + end + end + + base.class_eval do + def __elasticsearch__ + @__elasticsearch__ ||= NoObject.new + end + end + end + + end + end + +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 5ad9b97ff..2e5bfde22 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,2058 +1,2057 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20160128024452) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "at_messages", :force => true do |t| - t.integer "user_id" - t.integer "at_message_id" - t.string "at_message_type" - t.boolean "viewed", :default => false - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sender_id" - end - - add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" - - create_table "attachment_histories", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.string "filename", :default => "" - t.string "disk_filename", :default => "" - t.integer "filesize", :default => 0 - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "" - t.integer "downloads", :default => 0 - t.integer "author_id" - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.integer "copy_from" - t.integer "quotes" - t.integer "version" - t.integer "attachment_id" - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "homepage_id" - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - t.integer "org_subfield_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - 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" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score" - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - 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 - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 - t.integer "end_time" - t.string "end_term" - t.integer "is_excellent", :default => 0 - t.integer "excellent_option", :default => 0 - t.integer "is_copy", :default => 0 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - 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 - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 - t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false - end - - create_table "editor_of_documents", :force => true do |t| - t.integer "editor_id" - t.integer "org_document_comment_id" - t.datetime "created_at" - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - 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 - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - t.integer "quotes", :default => 0 - end - - add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :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", ["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" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - t.integer "private", :default => 0 - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.integer "quotes" - t.integer "status", :default => 0 - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_messages", :force => true do |t| - t.integer "user_id" - t.integer "sender_id" - t.integer "organization_id" - t.string "message_type" - t.integer "message_id" - t.integer "viewed" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 0 - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "org_subfield_messages", :force => true do |t| - t.integer "org_subfield_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_subfields", :force => true do |t| - t.integer "organization_id" - t.integer "priority" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "field_type" - t.integer "hide", :default => 0 - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "allow_guest_download", :default => true - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - t.integer "board_num", :default => 0 - t.integer "act_num", :default => 0 - t.integer "attach_num", :default => 0 - t.datetime "commit_time" - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - t.integer "forked_from_project_id" - t.integer "forked_count" - t.integer "commits_count", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "issues_count", :default => 0 - t.integer "attachments_count", :default => 0 - t.integer "boards_count", :default => 0 - t.integer "news_count", :default => 0 - t.integer "acts_count", :default => 0 - t.integer "journals_count", :default => 0 - t.integer "boards_reply_count", :default => 0 - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "shield_activities", :force => true do |t| - t.string "container_type" - t.integer "container_id" - t.string "shield_type" - t.integer "shield_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_projects", :force => true do |t| - t.integer "homework_common_id" - t.integer "student_work_id" - t.integer "project_id" - t.integer "user_id" - t.integer "is_leader" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" - add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" - add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" - add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "subfield_subdomain_dirs", :force => true do |t| - t.integer "org_subfield_id" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "user_wechats", :force => true do |t| - t.integer "subscribe" - t.string "openid" - t.string "nickname" - t.integer "sex" - t.string "language" - t.string "city" - t.string "province" - t.string "country" - t.string "headimgurl" - t.string "subscribe_time" - t.string "unionid" - t.string "remark" - t.integer "groupid" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - 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" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wechat_logs", :force => true do |t| - t.string "openid", :null => false - t.text "request_raw" - t.text "response_raw" - t.text "session_raw" - t.datetime "created_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20160128024452) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "at_messages", :force => true do |t| + t.integer "user_id" + t.integer "at_message_id" + t.string "at_message_type" + t.boolean "viewed", :default => false + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sender_id" + end + + add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "attachment_id" + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "homepage_id" + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + t.integer "org_subfield_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + 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" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_contributor_scores", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.integer "message_num" + t.integer "message_reply_num" + t.integer "news_reply_num" + t.integer "resource_num" + t.integer "journal_num" + t.integer "journal_reply_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "total_score" + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + 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 + t.string "content" + t.integer "status" + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 + t.integer "end_time" + t.string "end_term" + t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + 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 + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 + t.string "File" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false + end + + create_table "editor_of_documents", :force => true do |t| + t.integer "editor_id" + t.integer "org_document_comment_id" + t.datetime "created_at" + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + 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 + t.string "secret_key" + t.integer "status" + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + t.integer "quotes", :default => 0 + end + + add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :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", ["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" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + t.integer "private", :default => 0 + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.integer "quotes" + t.integer "status", :default => 0 + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_messages", :force => true do |t| + t.integer "user_id" + t.integer "sender_id" + t.integer "organization_id" + t.string "message_type" + t.integer "message_id" + t.integer "viewed" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 0 + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "org_subfield_messages", :force => true do |t| + t.integer "org_subfield_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_subfields", :force => true do |t| + t.integer "organization_id" + t.integer "priority" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "field_type" + t.integer "hide", :default => 0 + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "allow_guest_download", :default => true + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + t.integer "board_num", :default => 0 + t.integer "attach_num", :default => 0 + t.datetime "commit_time" + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + t.integer "forked_from_project_id" + t.integer "forked_count" + t.integer "commits_count", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "issues_count", :default => 0 + t.integer "attachments_count", :default => 0 + t.integer "boards_count", :default => 0 + t.integer "news_count", :default => 0 + t.integer "acts_count", :default => 0 + t.integer "journals_count", :default => 0 + t.integer "boards_reply_count", :default => 0 + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "is_teacher_score", :default => 0 + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "shield_activities", :force => true do |t| + t.string "container_type" + t.integer "container_id" + t.string "shield_type" + t.integer "shield_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "student_work_projects", :force => true do |t| + t.integer "homework_common_id" + t.integer "student_work_id" + t.integer "project_id" + t.integer "user_id" + t.integer "is_leader" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" + add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" + add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" + add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + end + + add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "subfield_subdomain_dirs", :force => true do |t| + t.integer "org_subfield_id" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "user_wechats", :force => true do |t| + t.integer "subscribe" + t.string "openid" + t.string "nickname" + t.integer "sex" + t.string "language" + t.string "city" + t.string "province" + t.string "country" + t.string "headimgurl" + t.string "subscribe_time" + t.string "unionid" + t.string "remark" + t.integer "groupid" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + 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" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wechat_logs", :force => true do |t| + t.string "openid", :null => false + t.text "request_raw" + t.text "response_raw" + t.text "session_raw" + t.datetime "created_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end From 63596c2ca542a86d780e72a37c9aed1ad2e2e78b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 Jan 2016 21:14:44 +0800 Subject: [PATCH 859/913] =?UTF-8?q?=E7=95=99=E8=A8=80=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E4=B8=BAJournalsForMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/words/create_reply.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d9e00a112..b4e28c894 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); - init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "JournalsForMessage"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> $("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>"); From eb9232a087583c021bcc58c189a455ac7a3e5800 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 Jan 2016 21:15:23 +0800 Subject: [PATCH 860/913] =?UTF-8?q?at=20controller=20=E7=9A=84json?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 783e7d323..d6470ce51 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -770,6 +770,7 @@ class ApplicationController < ActionController::Base end def api_request? + return false if params[:controller] == 'at' %w(xml json).include? params[:format] end From 71778ba94846058982514e8702b401843b6baed6 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 Jan 2016 22:09:16 +0800 Subject: [PATCH 861/913] =?UTF-8?q?=E6=8B=B7=E8=B4=9D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 6 ++++- app/helpers/avatar_helper.rb | 36 ++++++++++++++++++++++--- app/models/course_activity.rb | 2 +- app/views/courses/_copy_course.html.erb | 3 ++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 97dacb178..36060d41c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -442,10 +442,14 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.is_copy = 1 + @course.is_copy = params[:copy_course].to_i @course.open_student = copy_course.open_student @course.publish_resource = copy_course.publish_resource @course.save + + #copy avatar + copy_avatar(@course, copy_course) + if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| diff --git a/app/helpers/avatar_helper.rb b/app/helpers/avatar_helper.rb index 3f6802f59..0291d177f 100644 --- a/app/helpers/avatar_helper.rb +++ b/app/helpers/avatar_helper.rb @@ -1,9 +1,24 @@ module AvatarHelper AVATAR_SIZE="50x50" + + def copy_avatar(des, src) + src_file = disk_filename(src.class,src.id) + des_file = disk_filename(des.class,des.id) + + FileUtils.cp(src_file, des_file) if File.exist?(src_file) + end - def avatar_image(source) - File.join(relative_path, avatar_directory(source.class), source.id.to_s) + def avatar_image(source, copyed=false) + source_type = source.class + source_id = source.id + + course = Course.find(source_id) rescue nil + if course && copyed + source_id = course.is_copy + end + + File.join(relative_path, avatar_directory(source_type), source_id.to_s) end def relative_path @@ -23,7 +38,18 @@ module AvatarHelper end def disk_filename(source_type,source_id,image_file=nil) - File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + end + + def copy_course?(source_type, source_id) + file= disk_filename(source_type, source_id) + if source_type == Course && !File.exist?(file) + course = Course.find(source_id) rescue nil + if course && course.is_copy>0 + return true + end + end + false end def file_extension(filename=nil) @@ -35,7 +61,9 @@ module AvatarHelper return File.join(relative_path,'AnonymousUser','0') end if source.class && source.id && File.exist?(disk_filename(source.class,source.id)) - avatar_image(source) + avatar_image(source, false) + elsif copy_course?(source.class, source.id) + avatar_image(source, true) else File.join(relative_path,avatar_directory(source.class),'0') end diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 194e1183a..c9c6cec4b 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -72,7 +72,7 @@ class CourseActivity < ActiveRecord::Base # message的status状态为0为正常,为1表示创建课程时发送的message message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 - message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) + message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first end end end diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index a759946f6..c7547adcd 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -39,12 +39,13 @@
            • - <%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%> + <%= image_tag(url_to_avatar(@course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
            • + From 8b9bcb4719b883cca76af9b9a7f356fa2c9cd2da Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 1 Feb 2016 10:04:07 +0800 Subject: [PATCH 862/913] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E6=90=9C=E7=B4=A2=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 12f112345..9eabc95f2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -458,9 +458,9 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #全部 visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'} and (name like '%#{search}%')").order("created_at desc") + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc") elsif params[:type] == "2" #课程资源 - @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc") end @type = params[:type] @limit = 15 From 83a3c879d4b40b5858a8ce01ee0174a491761b65 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 1 Feb 2016 10:40:42 +0800 Subject: [PATCH 863/913] =?UTF-8?q?=E7=A7=81=E4=BF=A1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- public/images/hwork_icon.png | Bin 10436 -> 10537 bytes public/stylesheets/new_user.css | 2 ++ public/stylesheets/public.css | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a0808bdd..9f516ae1a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper def link_to_user_version(version, options = {}) return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue" end # 判断课程是否为精品课程 diff --git a/public/images/hwork_icon.png b/public/images/hwork_icon.png index 8ae87460fd13f21c15c187d31792b29d6d0ae6dd..f531c3d4c4c2881b535f5eabf341d5c071102b70 100644 GIT binary patch delta 9339 zcmZ{pRZtwjwyt9Y4>CBxHMmP~8<@c*_#nZ8hu|^{AxLl;T!Rc6Jh;2NJHegc&Rq7b za~{sa?yBxp)!nQ6rK{`v|J9{ls8J4lWymKe%`40Wl#>wS8|CS5Se#P~_7s&j#O|;a` zE*ch=AI<;!1+xDw7tZlo8g@)m67k{%Lpn%SO3P#6FdaSZ{ikZ=NprP}tLimdztRPLb!dovm6V>uFP(0SYljtKQDtljrBk2EmRTgl2FLu_H|llW_+$8;-R0^mS@JtV|pQCgQGbD2-AO&%mBBMWH9A))7~0dW!uhE16Q5-$UqX_){Tg*(g4cl9!|^=@)^s|5`K z4vj<%pT3ZOHftn*nBb0ZA2V>%Zipgq!9yq$#ygG?>%@wF6Ne>+amkZ%*uAVfWwDq)s^Zq7Ln#E!x-f${;kuG&A-(5;kaT?wc%dD4V zI>EEc!mV#U#Uq|_ht%F7jV`G)oaWX{t_R4H@WYxtqtr<(@(K)#lgqYEKsxcvfx41D z{29_J{Q@<_E;IU-IT#veD<Bkr_oE&5DWmo^xC)| zKuMEp8qLiD68$+;+8W;Oq4-Nns4Z~ha+#7WGCb$eH6FE4SMYY7C0kdtBi<@nIP_eF z`tVb;J*CT*Kl5MSOL7Fbw)<_kZiW^J9#%?&`TFK``d@z}+=Lkfcf`ep6*avrk#k?Z z6cjxo3L6H4AYmirN3sy;>1PNNR^M^3-}sa*Z?@YwWHBo<&yZG>?9d>6=bmD7S318};>f1BKpog;L}AMMKZj!**_U@sFz7!x7KJx`c~~ zW>4ff;k5#(T)H~RQ@nEw<`2IZt7DM9n_-xi>taZk0}Yw(#!tK>nAr02_t=6WJFcv6 zQd8<^n@_pcT!L}wF&gRMc*?FEjXbA+N!)v z3a?~5K+WlbLFuZAS8GcKt0oh;kCS?|07udFl5dY3=A;}4KM`y`r7xb)ogCyw&)e%V zUWXp1nSX?8oF_T;TPWDq;3dNBB`f}@6 z)@W5TtTcnX4r86LC&}=)KSVj4)Z2e+K1aLEQa5OaWlqKYc{jGGQpl{Z|FpoyTHU8I zXCGJ3Q@bm^NrYj|`_~*F-Aeu=+&W@#W|Vys^T5AtaH>K6c*G0af!sTXEmnkNZZ)LKd&;OPxpmE3v8OrhS5x)YLaUE4toGPZs&|B>AbjrxMOkAHS* zM(^|3aJHd<0GjVloa6-Li9lA{Fm9L3!CtxV9^$Ga!(&}f)}?_hJCpzo?XXmHL@xtq z5f?xdInWf?L)N~|eHpTPvirW6$|RTSc-9DpWjR4|uKXri+V-E9pjLnAkN3hhLr_x^ z!;^+?g($#5D$s#yoX65OtGFtZ5x0boJ~g{Xkk< zjWoKcwx2TxgaUvFq)==9v1Bc=SVm=d=_N&dnI=hiXjWyUwNfcrWf)pi7zt%Zt1o<< zmsX`ds^>mi#Rk|+wz5cK z;;}Qu5RW(<9_Bl%Z8ITidAs6cYH!GUAgs%e$ejf5(<-Z*H43L7-N2V zDeNF!^#t)Ak~vy}{;C_joF~b$%24PZY6u#h%;)EBE#7E?iZqP!D?i%y?GnTv)afQj zzH^L9+kE4sa1>v5vkl4e+_gP8ih$)UaTky57+{2`Zp%1_wi99|-yTQHNg$SMbx<~w zoN|(>)Yt^E62Kw`go~FkB_bjcO!3?z>)Xq8j7qmQw4~*~%wSSTJIxA>8ESl6yhwEcuH-u>F#JAj**^8~I#7+@d2s;%>i&3L&D}e?nxIk+66f9V9GctvqjXcF z{?THj&ib7}G)3uW0Z19@YfW!DMe+&$PZx6X6(FoxlJ+pk$x zeiCzSTaU4&uhg-l@9+UrOt2vJJ`6dY9}&YuGQpKx(8poc?ImK(yqJUikOrRQ9^@A? zv6!Qyp^B>?jk;#gpb+zvdDnhZObsTXrcFp33DD3g7hUHJ#8Kt)&4!ePEFOCrm|9h? zsi&$`y@Ux=vz0iQ|NW~<-^+NS;FSV2`^|6&y>}+Dtd*JqwAp@<9TuxHNy)vRs%&|6 z&@ot<*2~Cc!2i*~iOu;OwbRF)sd&`R%CP+JL#iGjPKUK{JjY>_8}EJB&vOQXul8Ys zhQPjJW}Xs6+ou!WoOzv|skHDE>7L9mf|J~tdG+|Qebn(ysQrBWGD^Lcngr>3dbp+>I0OTtvBJF&&AR)~HJ(DA zXlqf#y9tr-I6*_Os<*K_-Ws;_+D^y7DV}LK*=xNRFUsM=APm7xpjg<}NZsnVbFeJ^ z#3vR@8cCfRyW~~Tdn;>{4EW$FyovDg^{hf1AD@*7x>R)`cjFYg?!7U&{^hD}gDOO^ zvgiNoZHBI7(_Lp4<-^pO#ms5yEo5XqGr6v-jAQ2SO|q=6THXE0X>;taIdUW&aqoV` zk+(lDY?{3155vfb^)ZOiqZ4BQYfg3e_U>Mf;YMuHayPGM@u#~S+gVde?IjBFK~!e_ zxv*@ZW-`r=ik|lLLsP%R&;)hO>D}Kgiff#jr2W&j9Qqo$OQ9E+7U{2vYLPFt!44~C z?W9UL#>R>bLW5JhuiV6hdjtjlE2DaW{*wMpG_K?;diVho4*UlhK1{EX?83cd(f#m& z7ar3Y=;2S^^9UYjWuEh{cX0k?Oo-yuI|mL+dRZSdbr ziNP%R=pXlo9A3Q>7~lDw$1KM}BEqd9#`$S*W~RQe7$bJ`+ek}ia-F;rzrVBD+h%d$ z(2nAev!k?AY~1%s{~;5;bZTujD&1)OXz2kVHN#S;6S^)ewFc2>8Ri-qj@xVs(^j26+VETnt+t&l z&2?K)G16zVZ4BbVI-wg)Q;!hG|ESTKY}s+1?YkV30bsxpM)lnKeAd=I6$UP^5mV=k_{VLhhVU2dF%p9?ic>} zjsw6OXJFc{i*V%mim)5Gj?P5bL9eF;(t_%}b$^f8D! zlGd9%=JJv&0COV-1Yj~$FNSUhVUw%mY(JReOQn5kI3TRGUAnZ(*|PCEeY`#2wlD44 z!Fl&>hXYcigd>{g)R_hvbhaSbTYm>Y`-1u%nuK|Z3e6Ahi8VlT;4*!fOHuVl`|>() z2D2Yiz8CLg{P`8zvOLx&d5J3pz#d<~O&RE)#m`$<-@^1S&9?#$OE+awxHaFzZe=C1 zbUvtiU> z3-3ivs)*Qo%1ODoxjh-km`w_X26mu|&O%qphXBc1s05lB*17{YO>UEac5)~8GTmHV zpFdn!&$7$sL4WESg#BV>j)XdZ8hstb94XIxMEv*SkX6L!dgHQ%R5f;CU-{3&*KRQl zw7)1Vt1Jk+Y#e)2FESD2*q^sZ{OkIW&0kSuE?^=mf9J^O7)cVo;eub zD;L3e4V$pA{syxssDyp0+?9d8BYV7+nvDV#EbkUg5kbGD z#J}FJViw7#X#Gfq7IFNqVA`y!`BM>H5>ES0fCrOCXR zXvGtuqp?~im^o?;kTabeG!rWmCZ2v4E1gn2Vre&4UQqTD39vTx&)M;s#lF%)tqUIH zO#fc7Jj~<$Y(&O!Y1o&aSsT!*10vVVwu{$Q)`z+u^J=Tggd^pa-$>-{8$dy0~U>*?R+KcW6+!E}&uBf=ZXvQbC9PZ;*i+K*L%)${$Yo&K1Gf9k<;D9uSkK zcZpgq?ydOU2vhe_wsLJq2D&d{NmL}xA~0{TRj*?9?1pGLhY;0sNzv(?Q=0NF^uojr zDuV$b*bB43t?oG}4NVY?!v;mF%wS+=4EJ`10MCYsFNI>25{u@I6E4yHuU++xB;5q( zVK}#*CR`Fq(xNFZ;9qe`;12)*+z%J+KM`gNVSdXk>t%BU%rkGx=DJfR@i2=t>``{g z1EVC|e8^7|rJy#J(NM4JW8JnQ&2y#N=^%TM?5;E2PS^61dDg1l|N3T=LT?Wfg{>w# z#$XO#9j7ku-e{V73nc-GZ-1E%$9K48N_3 zbj}NY+<=QrH|qoKu9-@xk(n1vD=>XCl@EKgD)h0gL#&%gad_kfQ~Xj>gnTHF`yv*? zxO!jUo3Kz9X~aNKOk7?Zc(#WzNa}mrRy7mZoq7CbGfZjA+C2u_qT(3FoH@myik+Z< zP#m-&$|0Mg1MKDD5LQyK{&dkuDYQTzT(a67BV&{(eOPjRDY(=Sgh%Yu2{XwcE`gh# z8q}9YitJuq^%WS8*k~aZYPg5!JT0dsGkhNGAiPJ%FWnwh?Y1V;J6e0+#M2B9P6Z$QvK)OvozZVXGZp2JbV{5Wv;E3fa=xqO4iz(yQ zOJGN{a4J8|S+QgC7K0bas~G-ls{}OueO?=vWWz&wTCBHVLdC3LSW^M3ojIprbvCBC z>_cAMl4+6zxdRDA;ztCqNit@=b}H9u;R6phNGZ2iT@8+!x)%S8IjX8<@Z z2`cQF*t2ih`{yMiXU4E0JfbDdO*x@4`dZ7daLP~fWjuZm{C0XzG153_ z8yexqr^}Zz-(ObLmP%V+ty1tc7C+>5jm1Zvvsq@+Jq*dyaj(K8t%qforTXd#zh_9g zu>Vu%+3t_x-fSs_pO(GmBgp$(J@ovwVKOWt$eJ-Zb^zDMwy2`pa%-AJ2q!GCqqL8` zfqxTA5dIk8*V2l!oxpCe4K5^d;t*}9gNb=x{XPa~cH!;FuOQogP^6JJywJ#xRMo#oAUhkVRbN~JuRRsSr2$iW;M2X0?l5$k z%0DN-kK2hQCC=_Tt90>aJ`Tq3xt&n~1I*nj4t*=%Y$m1<74JlhG=u~;MPfzu^;vQI z?*r_aw%>er1e0F6e(;>Eq|64A5eJS>F;5H=l;C#M`TuGS7QH@Y3D(Y2+H%ldnrBxG zraW$bbf)O!OKR^nCdFJeB>xW!!X}hkPK-UikWkCY;vKLwj0IZgUF+tFjh}}~WVZ<> zNUG*R-R+nD>@C$hZ;R?x{|%nF+$E@r=*uB_PjQQb-j1b?QEgd*Ws9~hI7p+>P#z@- z0oF)^Jt+bw-tJSKfaqgqn_RG{2ydRKp4q^|Zn`(7q3PF$Whqm#H{*Qautd+puQLs< z2P5dOPGUP3+PMTZjpuT8T#x^Hu0+k2LKb(mh_n8qDnZiG{RLN|}IBT#FLT4}U9Ohqe-E zJ2JbIExMIv@Y`;u6kWz3Dq2jfylE(t)#w>KExWu1J*HtnmZK^2j96xc*7_2=jk`an zeVj?&vZ5O)tO&&m7%75cem3)-2#t8}3?)BK7rm3{8wcX|mvNIG-;lTD1t%B=#)Q8@ zUb2}o+M+OG(=Aw6_;dzgzk$O-s7Gi=(+t@NTF5&mYa;9@wul{FK%ZJ^sPPL=^hMKl zxwumfP6O3H|Ii+tZCNBYFUjUgU!BrFn_O79qh=qW{e?}S&q>euoRdnLg9+?(ckYC{Y6nQ6?~Cc6u!cQ4jaSu*ZQ5X zACHY1eROmL=-^@_9APEEu$ov`iy%QvSv52?Sngli2{e9LZGpZ^xnKqn{~#G!SXf{j zI|D&XA`VUY%Q4JX=?3A;HSQ-yI|?vok_CH>fm*7gbD?Z`vY>HEObDJXvEoPT=uQ`> z+^A?o--vSlB&N*}p2OcXSXuVg;(ZOCE~LX*cplZu%L_>58Wn!zbvaO7+0#^EULn8# z^BI{KD~~G$=1Cpz<90mZQK9l0$O79!$dqFh{p6>NnRovZuGJ;x4HYRt%TXXo;owVc zyh%j4Rh0%I*A?!(b|w004YJ1mUiA$WG%dyxnmu^unRWq1idn#P)`{;M>5pJKB_8YT zKkOs^Jb+pm(Kc8HkkX)aLz|o`YpCk{(_>6rSkRqed#*Vp$}Sl)!6l7jVOb2@h!9t9j3Z9`>> zOEGR`^ncSYj=Y0$!WO6lZeF*iK_Z;!^I7-Ld>0ubNqH?9A}Dq?ztwj~L`1OOw}$k< zG4-(HRv8pR#7!O@;^JxxOZA?(XYSwQmaSIIM1O3LS*ot8a^_%f)`_Wps-NkJer!Q% zS0c>s2Ws|8cLrL%8ss?#of$@Y$VK{&l00&AGzTa<*(o%pz8_ZWy^~@`^T#RD$+wSt5mCfYHnekYX6>nobfdnv zdVIjCw41+rKkv=zL@B=nQacp#`5hKaagFstHGjr!-xUX-MA z;|UE~`;3b42RHpIvEUL8jCLRAu6?c~Fyf;hL3w8C zT!+Tf4EGH`c10~Y3*nKKtE+36inwRL{qnL{z3YLXPe2eIY+~_4zFORP<<(W>zJK_A zpO$eFgGW9r)@ntaji?rX$f5(+AV;C5E+cWs(wQGydIxdoE3Hs)~N)jTK*u zXt`-;P}rWdvHX$1et-Vc=VfF*YSD2FZ$Z=pc(t4^=r&J_$CEgH$_9aK0sG2JbB_7u^NqY50y%<^Hy^S`H6_|)*v=}W}37DMr&){6;?6H93+ zJf0J=I~lOQI4gDpsW7u5Li$DJW%kUHi+f%$LmB}YfusHda_H+E7GV*mN*}%gry`A?i zC*zbY#dA$X{?-5Y6{TOGKf8<1<4bx;_!<)jY)m4>=rnxmb48s{jKWaPC(gvd$I_M- zUx^e)$#jsLpIxWzTk|Y6-B>U}yg-#BSt&B#qIpFH*L|F}IPQ*83Igvp&p>IF(FfMR z58Wz>`x=T)vtFx+IojIt%16HUWY{s(`So>uxWU(tBaSc9&Sw7aB4ie_Ej03Iq8sY~ zQ;RxmG{277lg6Wnf6HR@uA;f3zW%oN&FO&!E*0I0XxK00vuEYq!8OI;cinT(2MwAq<^K77Dfd^6_p@U3gzmBx)|Mgq=0amG$F4Tq42XX{1-+7;;a zL$iKWfpKG#WFD(3EJdkyGzsi;Yzj4p5yO0?4Z(w&iis)qupdOKfWG_P zIocAYjSaE_s%E%JOL8Pq5!*ZGka#bz+wD~{$HJ^iO<8vTyFg6}{P35beQ!h9XBY$K zNUl-(E1^W*uGQW)at%To?Q<*|PIu+vv1?1fu<6IhWMD=^WWrWwgn`fMEHy9eQPhjn zb7O;Kf+AKmPcgNGdeU`w<`c%|U{ii$<9!u2Hn!#$SJNizQ0tUL4gYg)3>j2m4W{0?E-V%pH^n8e_ElOe ziu3~{{OEV02{+#C@S2D90pYsy@lQ*130yhU9(lV`HQPI7r_`2W)!9N#KA7MAc^1!wjN>=ilYRI3CIX$In(=@7-e(QkIj}@txnx#%Xz}n{syu(QR!x z_{zw61?mSqf57;WS};NF-H&IU_p~kuqiIMVzvz`7YcF_Oa7;sl-Fvb6KueCvney43 z4LO~E0+Zj|@ewkpI?d=X+v92qFI(|>BPKiymT`ye72yntZm{n418`6 z#NoRyC36qwJ|kAbJsj#I#3^#sc;@B`cv4wB?kLx@I&51(&$sH*)s3mY_4IqQxi_dE zbiYzrs86K+~_fMnz!goA}dfUZKD+t*o>f_^k%QWJI#0{`l#4Cx{AZ< zl63xrRys&h%T!}G8X1q(E^SH-uO?9y4T&8VS}V;G&XQC`Px~f{L|hKoIm{WwjEa0i zy)-b@5R!CJPoetuNnCChAQ;`x8-8LIPoBh_^ahg7j(f`1Fkjaqd7(@hA+*&=I1$>* zY~4M_Rv*#B|I15tiBoopv{aJSpEd%xx{($kpnAEtWb{zmvbORkH*Ueu^C>5OCxAfD zQ#Z;z61(f>4~e@9vZ>AFJ-(K=?vG>aiw<-|CNHI~21fBb9m-v5X@8zl}CFqGdZ1YwO$dE@}A(6FE8PqKg7e z{F2y8g%2Nf1o4aTBA999aB{bo9ZlQVk-d@Ytl5ZfTf%QG?n$;$ip+6iB@q2foBylO z`>;e1#lydP{pSh%OSk_S^iSy2jG5Ee;_pQ&^LMI6dX*`q^32rCW23V?dxg_(#8XaA zde>tV_pDDApb4ic`6IjA0pIeV7* z`~R@>h!EWKt!hP8iYU>^sVKp50wg)v2gOnu%XJFjddP%SC@5I7@2pmirwIHd0cm>1 zXiAC`lEM?_rJ86Ni{wLfJ-e{ZII-Ba8T%yQQ2uDXCJ>z(Ui_x8P9x5P3f7$G$WA6lXP& zxfjFROT`}pF3uXq|FoK&Gao1CJQnc!n!|`l zf`Eh(TRUGS_%j)I6>pu1nrUy*#GMMC1Xm|@=w~S}U#k%+X|q1|Xq^cDB4oUi(un~X z@Xp1lGem-OAelzsyPuG&+(tuLD7cV!wO4@9d?<`7@dr+TPtioe9Ku7}_^sioMWuEL zst|UnOR{6>iXt}oO^qSoSqElYe&8r@P&jDt5Gq7nDL8Vr1%$ML}fZECZ zOtl?FBd2-$m<7+k#uJ9V?!E&?tc@%Qo5IO?pf+FUiOJ%RUe^;)pw$QL2$ql!w4c;E zVMZ42dA~>h(ZyC?G>?FmkPG9Kg!1Tbq%JToSaMr2CC$mvH*&*c<%VD48A=&yW6CF$NqrU9KusM%YmC&=h}smFD1V*)0?FoJo8DD`>zd zLa{WQ@LeALvIij^Yk9XC;%GG~nW6hUjG^u@uU6sR&{j_ua46^<&rQh1LwL5!hRtjL z>B8lKQXaohH@;Wd4sAsI%NtFKN6TJ|5bK_(SoThIcq~P0+w6oXSkT&>px}1|U99BR zT|OQ9d{C#@!KyV>%unWcFm)~7Wx#(1%Kjb{rs+1>H`IA-Of~OecH%srD*mSVXt|J! zB1HyDGo57wxPRxM7vr$Be{y$u|Nro+zyH+#^`>z%fbRF2_Su0^8l(nFg;ewR>Wo8S z59Rb$tf3UubKS~eE?XXg?Oh1zU_b9vKl(xB*~$2yYG6;&-1}F8^EcG;#i&cQ@PxBX zyjZh%eHB+VK*`wbXK8ddaBb-lXjVI>_dR)~;yZE0pg#EY?p>_7&o<5!HXJ?orwQ#Y z;5>+2c+N?JSELE{yC8N)Bh}pzvHHR;G=b54?Q?MDQy#c6A*iNR=li`9zlswi_E%9o;Q)(t2Rjq8V|SHUsN8ea^@;ZjP_MmKGsl zs?SZ@?^0+n*^yDT0x<`*!dIUf$s8ZJ@15%%H=m|QEY%ma)-Ph_>@93_Sh_31iyJ12 zkzDOS$!^v@m4}^C>IJ{GXUm9>Y2g5E1X58Q{K!pdKdt&=emJjT7bSqsWN&b@4Mok6 z66dmhoVM=g$Ae>jB*;saEc#4it!>p7q|<1!r6m>d_G2=jw`-Sbi{=ock?3z;%Qb&s z?TJd*Y+LhMe3IzNikA}UHQ5sEj8r=yVQ%0>21kV7z)8e<<9*d@Gl|+a2oC=0B$GSm ztb(9IwNCqNL8ujn*TiE(6aV%8sD^vn>sJQ)@uHyq zcWLQIQqZqBaERIooF8T7uI=7+e%OD+>e0jQ)EBbn&hN4He({At50#<9>zVN}eHf4t zXb#VXdbAD4Q=r$}Y+3JiUyPXchr#dP`V#BMvozt#u}fvBf;Dp~6zJZh_AydT=;OkY z!{EEFW~_&8sYvU#62YB*+swNnn@KEWr6@|o$HjIy*6&rts zzC`MStezI;8CD}>&o*ONe~Jj`UsP!7Ygrqq2bYi8A*N>BRm|ks=~g)vfeat*UFQmA zdrYYP_-R~Qrn|gX)8`-_of{9be4W9-O2gA(@Tjnlw#K{0ziU6M=nZ;GH_JZXvIo_lf(X_^pg`i5oi|r8PE6pRspz84Tk)HAL%qrRy zRoew*CM$JaUEy*4PS)69byKF0tFxbQ(`}VkJdo@L-{osI4axxSgT=*NuXeg%Oq^Mc z>gDctAK(*l4*)sy-neJ77gYw|yGeLOnJc)oH7%^8U0JyOzm>@QMH>liQ5=IP^J@bb zi*?28Z6W>s3iSj9C#riH9CnV7A!Adt&g4q z73TXGpGqi|;7wvFOMjSeoa#lS-VO@v#LED8)7p^Kdn0bndrDB80+(DAa~Ll)w1@Oe zR~ic{vbIKg{NgSKc%7z)7Nj5c!zI9YyAC~*Y@}E;)>&tx8|>DcTt&rBmCQt4W1a}8 z=ZX9933~U%QZ(tC4T$J=qG zQ`{Gfifi`4WbiA_h|K+ZcsC`&b4)$#l&MEKWNRtL^*Cw9N{A_P`84qEdZs!MnO${< zmjV%lElTaGO-f26C>2&!0>9%EgAea4FgsHbGh$AQ+UNY}A--mj17g&Z2ZzKd=)(GG zNYe3rBk>>g@tb}#oaSxUuN+GRj>aMKX#OyZb0WWulQL$}(M-N98zwQ%Bv-KTB*!Lg zwOF{=Z;BmR{c(wbw}xd8ildzM@Wsa`pC_zy9LFwxnO!}7Ke{(p2c*rbTRPZao~vM$ zh{WB9VPK+<@+tgQpda`Bc4+EI>C&~9{cf{_J*FoI7-H6iky#vKyfz+RiO_`U>NQzK zQ&w3_Z*#|y;_!~Oj@iLi+WrA?GJCx&PT4Xz@v=8thxS*CDgB>U8LM-IJ$eusCy6KP zFH~$LRLc)}R_Rr;f#E3|ksc|f^0zyOqwg8q%#;lGr?9+@T7$FrJro|B4wV?E-V}VB zG9da`5@zv^xItHG%n>(iX7kC$iO|@#@+%l1=zm(_I{EHp<2Ih>^Ub8ySng2cAKkh3 zH{`EzB{>Ukj6;Ny_MGW=GcBHwAC*QC_n2!{2X2(Z?*&HP zSzFJ4UHctRPoIW=FCH$|fxqwtua9R)5Ay0#z*h)XaqP*11C#LnJoYGw=trI-u;6>$?(_rbBA&<8vm-&;K=`T!$^F%VSZ$5K29q>@oxPPpxmD@y$+M z9~!adkv!bqZZc8v18A~myQPV)=iRb6#}p^Al|p<$bL}sRL+P{Nf$LqnK`jzotIAr& zt(mDb)lG`HbS>Y{HeVMRZK*19@#24~Bl!Uid(9J%n`%@JCOVJVx*k%FoBnil(x%m; zy30}qZ=VuNy3GrQJN$8{H(kgCvlIwqfvW{|)ET&7Zyl}_fpUVRbJPQZ;t3Ncnc?F>*mjudQqULVIZr+&%UF*`lG`7>I67^D5l>8 z(cA~hv#R1Dc<%4MBBidpppPi9imW!5m#F~@G}jlEUYuCJZlHy$FWYq!cEwdAg1=6i zBD8X{duDZj2c9%@+mmGEiR+f}tsjuXj91i^DE2hF(aR4KP3P=?xmXp7UP@OgcHv0H z)#s{Qf~yNINC8ru8}TP!3H?^P>)$^Q=IKY(Jwz)z*`r?+Uq$6_;Ua=#%w}FP?jDw^ zrq;BuKq`ZN#&6gT@T@*dx-&JqFg3c4{&|y_TA~m5W|y-5{&ZiZH$W}&q2!MLpvUYm z>6+iIMYrXzBxmG>$_~|6Qrs}70v2aKtBOsp&HQ55Lho5++i>E$2s3lVT@4s1&I*40 zJ^{k1oV2wNT0wk25X+oy{ZTX_SQV%yZ~|pP2UB5UD<;rw@OG~DQX^E(tBMo&phj* zH$5@Gc3M(8^e@_>Wo0l`0D0%Zl#;iSGL$uSF9b}11-|vB`c+2okI-X#^PKS3LweLc zPlFAle=-{*lPI$mvF$1$;6iRytTqJxU2Y$!6EORTNBed-t~Isy>sC&cNFPI7x(Yyd zH2Sr$*NTb)lAf<*UirbEZ^To#zNOYu$^9Kd&;D>OKrGAt6{=i zk-15(6Z55J!HoBTA=_L55ynG6RNSC0^%{(`%C7{Sb_Eig%BVOY?YCZW8Da8h?O1jK z+RsTj3g1i&r;Q)6vVMHJcrE$J<<_09LLkTfe63#*WoT?C(GP)dlm}LOM(7oP`!`ho?|=f|GfE znE2Gjdyp5AxrQLVWZi7q)hB9_+iZyyphCn$MV{P^KGE^588<39dNxPJlvqw%T6?si z+6f{J&$N@P`69=xQ{_y-YQtKj26eWiAi**D;hWFLTuyp;$7T9?k;$7j#_LY)qL9_^ zwIO{rE2op;C&y|Kysti>Vs^$$JW-wXO`ux`5~)gT)HzvFpW9CNa~x_<=}nggB>9=u z%Y+pjuK70|6wg2tom)Oml@2sOtZRZ31XEDpQx&xlLcQ2`Q?oar{ z@G;_)5fBSvmEpjiXUd5TvWaS8xbPDA@9i*B{oPpYdpIk2@CKiUD>nb#jBGU6Mx6@e z7uk=bmS$1)r;^MVRxexTje4)q752oLxfc8HUeqJYD3;&LgHYy%uSCX=a=>^hL2;TE zzOFp5+j~+VOWe-iIeqM{6Nv0%oXNHowzO0Xz2ByaN<{SIohvPAzb|rFeD`6$SlD5$ zERTWvj8ZZY6{o^fyFYq!Ojy166u5IX!OVQCbnL@oQo{}Ehi3+P0s?-+j%}Xn0{T@m;7FPkQDo`nv6i|Z z;vR0?AEY3~N%5i4WwA+EWm`TAFP`IIc_@RQSAQQiyLsKG2=Z@<@o>PU^>QkDp5>u! z$0&P64Eunal|= z)|R=QZjQ}hd7}&N93Q?3Gn3E2z$GiUJjPB4kq`^@B7OCGAKJM^7VY*D#dt6 z90yCM#%e3l;TtU?`AdHxln(#UUw$8-wr4BR5pKvW-O+-b(@P^bvc6gGc#TX~!qexF zI%`)+m8ZYkoB~gyoG_A;31^(W4LHngccP$`lY6%Nx@j~FiYA;*<^6H2BANGHFkDI_ zKk%%|tZrjSxX$jb)V7llx-;gm(brc%@pAtv^y6DdvTUU;XD4OI`MyeIGKVv>W*W@2 zI=LxW#(@|UPssSZ)X7{jJpO6G9bvhCwM5Its*<+ZDCEG*LM6mr`QlMLH85aQYuWum z`e&f!SMP*rqa8fsp|XB)G1S%e(fXikJ`q}h{QWitq$>Dd1ZWgCy?8_+O{<&r^3UQw z^tviAsN!qJxSTFpW;!BmCY&wy?mbCqNE4_w0A;SNN3iF!WbFu@9(!6GQc&O%^(9>P@EIcMvFfaOy#9rRqYU_R zG4k{c@oRc@2|T>$6-?K-T)u__ItOgwZm~cB!Ep)%z9JgFhPbBt# zXb_XQUfbq*c}aJWsaZ(kXWMl-=sOi*I}Buv(G`j&Aes9|w3x@O5x zRTmU0buAex{SWwgo=e9GWGUUg(f-vV_=lgjeof?)4#{~*&Bv57@^rpWTZP?B<$9I$ z>DQDYLNGB8NU6cK^i$OABLr!(dCMTv)b+?nfrcayI^2n~_AU97mSfqRs#*CaOquK~ zr$a@e<-D)+E_5pI|3kc(!+Wi1WU74^xYqNz0Nox!g8RUPs-)F z7n`{=8_I~COL3_B3hD+>ceKbl-7Lvc7Lqtm-v+(yAUm5TmJjiz+6+);0v9E-{_?|_ zQ+)65uQ;_Lwxr^hdb5w`m+e;=d|?)H;bFwTI7+2r0Ru3JH{Z{0nqT%hls77ds~q~I zm~&1pmoi6EQ&W>kXANHt{(wVfUq!(y20oiY&(ldEX}ml&iyYG(WW=|EiE z$j0>aujP`d<2M4CJ6*ZF>d)oJLS-V|ur7N~-h*4(O&tP}Kdgv80FB;)FO< zpqj}kO7=~R_@7ri6P$Xfl2Ce$n}{<1R^aGP7a?04&W*(NjY7O?V{o8ES zG6(r2Oaz4O-Ax~nEe0)XU}OWeTR$*H8pm|62-ja0L=Trd>pJYs5rXe6zn*WDI{oz! zANZptjv)CW&uT38Fg`%FAJsqUN~w{lEZ{wQfN%Y#Z%Mw_RH}E;^jK8%(JLl_L$JZM zv0M9`!}Dxh!j`$(bDI;^s>bDk9g{{A7aeWwi7N*$orN|O(YNKE8dM$zZGSQL5dXNk z@^i)R+|_Mbj?>$qkKIKzgaS%iM8rXK_lWvdCysQk4P z?kM#YfZS-;NmJ;pkC&%smD#u7TX&K!3$yY}Gd8O|u~ZTk9pBIy8I5W93>K66{Z#7vC5MC)N%dBLifW;9>`}-Cw2X51%^PiDbnu9f|a1NO2bIPx7`w=I9 zYqwh}!zsA)G4rOs)FZ7uJdR087BlEc0|lNI$P7!*>-p&~orMk-GHGKShd#V|I?45P zSrPaSInvX{ZK{$UNtdWxpsF-I8&8=e*`A)B9(;YKopy5889~?{F~0+1m4`}G3R%Yh zr3_~_jGQX3o+}@9)V+S|j!Q?wh5cb?k%2hsPhL=i>sg<@R*-(;w0}iHy91?+Gh=b`_`tPqe<4E5#bN z1+15_uHLQFR)aHE*#^tl`wZj}f8BWjSoa5=h5lT{IxbaN5<6XbPi}hNt@GOJ+^rYn zVOMJ4nObe&XIN`+4PB>ud>k%C5;5mTqL9|a^i}*xr|Of9m_Ply2`$`DLYl&7m+`r6 zrl}|?$*6r6Rz%$!m#(8z$|aOL6BUQO2Uz)R>MQE%%8|6I5y5wVFZ6Wi}wcMP$ zx|_a&_^Abk5^b6bOt6LG)8oZ$ogFigQUR4BP6V59RMKaf8Gi$&>P)4Xo3z*Hx}u_s zEUP#}U&X(Uxmm{V#GzCSDTo8oB@cTXvqM`pGMrAo6|@F!T41?S{O}(?iOI@j0wP6r zLBtT&AqlC_r8I|Sa(nZ^Z*Hr%n$@%pkphYNx^LubB*zCOA^CR{_`IOcTxhD%kr^}e z@23rmc&okfcO^O^i%JPJmFxJyc9vAX`wTtvb9p)m9(A3olD{;xYMmyYW1A_MZ;`CHdt3>HDQ)8**7SQVkWjv6jxzXiqjN_^WbU4!yC?!CbrDsHmsoL6K#Z=wNFy3%CyI*l((m+ z!9Rje^0*~^|93ie#W~Ps2SG%2B752C z*@44qY$&Zu!EZlCb{auWF_gc*$-Cbkp>ex(eZ3C~;~q5(mRlDeoox1luRc}voE@a@ z$!U33B_9!oW_bhb7+A@~5!P{sTbAqC3ig8wB5LD&j81@w_Un|Uh_^Wky?2dqvgMR~ zlVISce zI&q|BE=*2Zf8eN?4FD*@1+`hIUGv|Bp?WDPDZvfp+oZ}9`uzp%1e>QQZ^@~sw)7YDTTx6{+e1LIeg@Eu=qV-&Pu(sB zE)jkH?Wg{lNwC;pX~_55fYl?6ot-2`(p9M>Hv|4fzkM1wrTl diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index d31c1ee0c..bc7922194 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -693,6 +693,8 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index be9d51799..a3135b78e 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -611,6 +611,8 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} /*a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}*/ /*a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;}*/ .homepagePostReplyPortrait {float:left; width:45px;} From 4d048ec5964cc13d746ba1a2af21f0247a6d1091 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 1 Feb 2016 11:12:04 +0800 Subject: [PATCH 864/913] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E4=B8=BA0=E7=9A=84=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_recommendation.html.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index 2b890ca5d..f26c5fd41 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -8,8 +8,13 @@

              <%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %>

              - <%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>) - <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)

              + <% if e_course.attachments.count > 0 %> + <%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>) + <% end %> + <% if e_course.homework_commons.count > 0 %> + <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>) + <% end %> +

            • From cdd997e45ef4ab1d7de64403de5d4eedf0a21603 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 1 Feb 2016 14:50:45 +0800 Subject: [PATCH 865/913] =?UTF-8?q?kindeditor=E5=9B=9E=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_comments/show.html.erb | 2 +- app/views/boards/_course_show_detail.html.erb | 20 ++++---- .../boards/_project_show_detail.html.erb | 20 ++++---- app/views/courses/_course_activity.html.erb | 48 ------------------- app/views/issues/index.html.erb | 18 +++---- app/views/news/_course_news_detail.html.erb | 20 ++++---- app/views/news/_project_news_detail.html.erb | 20 ++++---- .../org_document_comments/index.html.erb | 12 ----- app/views/org_document_comments/show.html.erb | 2 +- .../org_subfields/_show_post_type.html.erb | 13 ----- app/views/organizations/show.html.erb | 12 ----- app/views/users/_user_homework_list.html.erb | 12 ----- 12 files changed, 51 insertions(+), 148 deletions(-) diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index e6d8be24e..856a122d3 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -1,6 +1,6 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor",'blog' %> + <%= javascript_include_tag "create_kindeditor",'blog' %> <% end %> <% course_activities.each do |activity| if course_activities %> \ No newline at end of file From 105393548bac00e33d238221f7525282c9b7eeae Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 2 Feb 2016 11:23:17 +0800 Subject: [PATCH 867/913] =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=87=E6=9C=AC=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_comments/show.html.erb | 441 ++++++++--------- app/views/courses/syllabus.html.erb | 451 +++++++++--------- app/views/memos/show.html.erb | 11 +- app/views/messages/_course_show.html.erb | 13 +- .../messages/_org_subfield_show.html.erb | 421 ++++++++-------- app/views/messages/_project_show.html.erb | 11 +- app/views/news/_course_show.html.erb | 11 +- app/views/news/_organization_show.html.erb | 367 +++++++------- app/views/news/_project_show.html.erb | 11 +- 9 files changed, 891 insertions(+), 846 deletions(-) diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 4a407089f..51df656f0 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -1,218 +1,223 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor",'blog' %> -<% end %> - - - -
              -
              -
              - <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> -
              -
              - <% if @article.author.id == User.current.id%> - - <%end%> - -
              - -
              - <% if @article.try(:author).try(:realname) == ' ' %> - <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
              -
              <%= format_time( @article.created_on)%>
              -
              -
              - <%= @article.content.html_safe%> -
              -
              -
              - <%#= link_to_attachments_course @topic, :author => false %> - <% if @article.attachments.any?%> - <% options = {:author => true, :deletable => false} %> - <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> - <% end %> -
              -
              -
              -
              -
              - <% count=0 %> - <% if @article.parent %> - <% count=@article.parent.children.count%> - <% else %> - <% count=@article.children.count%> - <% end %> -
              - <%# unless count == 0 %> -
              -
              回复 - <%= count>0 ? "(#{count})" : "" %> - - <% if @article.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%> - <% end %> - -
              -
              - -
              -
              - <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> - -
              -
              - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
              -
              -
              - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
              -
              - <%= reply.content.html_safe%> -
              -
              - <%= format_time(reply.created_on) %> - - <% if reply.author == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> - <% end %> - - -
              -

              -
              -
              -
              - <% end %> -
              - - <%# end %> -
              - <% if !@article.locked? && User.current.logged?%> -
              - -
              -
              - <%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %> - <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %> - <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %> - <% end %> -
              -
              -
              - <% end %> -
              -
              - +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor",'blog' %> +<% end %> + + + +
              +
              +
              + <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> +
              +
              + <% if @article.author.id == User.current.id%> + + <%end%> + +
              + +
              + <% if @article.try(:author).try(:realname) == ' ' %> + <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
              +
              <%= format_time( @article.created_on)%>
              +
              +
              + <%= @article.content.html_safe%> +
              +
              +
              + <%#= link_to_attachments_course @topic, :author => false %> + <% if @article.attachments.any?%> + <% options = {:author => true, :deletable => false} %> + <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> + <% end %> +
              +
              +
              +
              +
              + <% count=0 %> + <% if @article.parent %> + <% count=@article.parent.children.count%> + <% else %> + <% count=@article.children.count%> + <% end %> +
              + <%# unless count == 0 %> +
              +
              回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if @article.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%> + <% end %> + +
              +
              + +
              +
              + <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> + +
              +
              + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
              +
              +
              + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
              +
              + <%= reply.content.html_safe%> +
              +
              + <%= format_time(reply.created_on) %> + + <% if reply.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> + <% end %> + + +
              +

              +
              +
              +
              + <% end %> +
              + + <%# end %> +
              + <% if !@article.locked? && User.current.logged?%> +
              + +
              +
              + <%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %> + <% end %> +
              +
              +
              + <% end %> +
              +
              + diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index c9d333e6d..aedf62eaf 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -1,224 +1,229 @@ - -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> - <%= javascript_include_tag 'blog' %> -<% end %> - - - - -
              -
              -
              - <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> -
              -
              - <% if User.current && @article.author.id == User.current.id%> -
              -
                -
              • -
                  -
                • - 重设大纲 -
                • -
                • - <%= link_to( - '取消大纲', - {:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id}, - :method => :delete, - :data => {:confirm => '您确定要取消么?'}, - :class => 'postOptionLink' - ) if User.current && User.current.id == @article.author.id %> -
                • -
                -
              • -
              -
              - - - - - - - - - <%end%> - -
              - -
              - <% if @article.try(:author).try(:realname) == ' ' %> - <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
              -
              <%= format_time( @article.created_on)%>
              -
              -
              - <%= @article.content.html_safe%> -
              -
              -
              - <%#= link_to_attachments_course @topic, :author => false %> - <% if @article.attachments.any?%> - <% options = {:author => true, :deletable => false} %> - <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> - <% end %> -
              -
              -
              -
              -
              - <% count=0 %> - <% if @article.parent %> - <% count=@article.parent.children.count%> - <% else %> - <% count=@article.children.count%> - <% end %> -
              - <% unless count == 0 %> -
              -
              回复(<%=count %>)
              -
              - -
              -
              - <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> - -
              -
              - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
              -
              -
              - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
              -
              - <%= reply.content.html_safe%> -
              -
              - <%= format_time(reply.created_on) %> - -
              -

              -
              -
              -
              - <% end %> -
              - - <% end %> -
              - <% if !@article.locked? && User.current.logged?%> - - - - - - - - - - - - - -
              -
              <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %>
              -
              -
              - <%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%> - - - - - - -
              - -
              -

              - <% end%> -
              -
              -
              -
              -
              - <% end %> -
              -
              - + +
              +
              +
              + <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> +
              +
              + <% if User.current && @article.author.id == User.current.id%> +
              +
                +
              • +
                  +
                • + 重设大纲 +
                • +
                • + <%= link_to( + '取消大纲', + {:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id}, + :method => :delete, + :data => {:confirm => '您确定要取消么?'}, + :class => 'postOptionLink' + ) if User.current && User.current.id == @article.author.id %> +
                • +
                +
              • +
              +
              + + + + + + + + + <%end%> + +
              + +
              + <% if @article.try(:author).try(:realname) == ' ' %> + <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
              +
              <%= format_time( @article.created_on)%>
              +
              +
              + <%= @article.content.html_safe%> +
              +
              +
              + <%#= link_to_attachments_course @topic, :author => false %> + <% if @article.attachments.any?%> + <% options = {:author => true, :deletable => false} %> + <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> + <% end %> +
              +
              +
              +
              +
              + <% count=0 %> + <% if @article.parent %> + <% count=@article.parent.children.count%> + <% else %> + <% count=@article.children.count%> + <% end %> +
              + <% unless count == 0 %> +
              +
              回复(<%=count %>)
              +
              + +
              +
              + <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> + +
              +
              + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
              +
              +
              + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
              +
              + <%= reply.content.html_safe%> +
              +
              + <%= format_time(reply.created_on) %> + +
              +

              +
              +
              +
              + <% end %> +
              + + <% end %> +
              + <% if !@article.locked? && User.current.logged?%> + + + + + + + + + + + + + +
              +
              <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %>
              +
              +
              + <%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%> + + + + + + +
              + +
              +

              + <% end%> +
              +
              +
              +
              +
              + <% end %> +
              +
              + \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 3028f3369..f5b171d8b 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -139,8 +139,13 @@
              \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 022b8c76b..57a75dde6 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -171,8 +171,13 @@
              + diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index fab0f752e..7cc60abf9 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -1,208 +1,213 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> - - - - -
              -
              -
              - <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> -
              -
              - <% if User.current.logged? %> - - <%end%> - -
              - -
              - <% if @topic.try(:author).try(:realname) == ' ' %> - <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
              -
              <%= format_time( @topic.created_on)%>
              -
              -
              - <%= @topic.content.html_safe%> -
              -
              -
              - <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %> -
              -
              -
              -
              -
              -
              - <% unless @replies.empty? %> -
              -
              回复(<%=@reply_count %>)
              -
              - -
              -
              - <% @replies.each_with_index do |reply,i| %> - -
              -
              - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
              -
              -
              - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
              -
              - <%= reply.content.html_safe%> -
              -
              - <%= format_time(reply.created_on) %> - -
              -

              -
              -
              -
              - <% end %> -
              - - <% end %> -
              - <% if !@topic.locked? && authorize_for_course('messages', 'reply') %> -
              - -
              -
              - <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %> - <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> - <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> - <% end %> -
              -
              -
              - <% end %> -
              -
              - +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + + + + +
              +
              +
              + <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
              +
              + <% if User.current.logged? %> + + <%end%> + +
              + +
              + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
              +
              <%= format_time( @topic.created_on)%>
              +
              +
              + <%= @topic.content.html_safe%> +
              +
              +
              + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %> +
              +
              +
              +
              +
              +
              + <% unless @replies.empty? %> +
              +
              回复(<%=@reply_count %>)
              +
              + +
              +
              + <% @replies.each_with_index do |reply,i| %> + +
              +
              + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
              +
              +
              + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
              +
              + <%= reply.content.html_safe%> +
              +
              + <%= format_time(reply.created_on) %> + +
              +

              +
              +
              +
              + <% end %> +
              + + <% end %> +
              + <% if !@topic.locked? && authorize_for_course('messages', 'reply') %> +
              + +
              +
              + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> + <% end %> +
              +
              +
              + <% end %> +
              +
              + diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index a0e9db171..988902b81 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -227,8 +227,13 @@
              diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 05a430d57..3236aa6a0 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -184,8 +184,13 @@
              diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index 3189b03bf..0a7770ac0 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -1,181 +1,186 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> -<% end %> - - - - -
              -
              -
              - <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> -
              -
              - <% if User.current.logged? %> - - <%end%> - -
              - -
              - <% if @news.try(:author).try(:realname) == ' ' %> - <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
              -
              <%= format_time( @news.created_on)%>
              -
              -
              - <%= @news.description.html_safe%> -
              -
              -
              - <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %> -
              -
              -
              -
              -
              -
              - <% unless @comments.empty? %> -
              -
              回复(<%=@comments.count %>)
              -
              -
              -
              - <% @comments.each_with_index do |reply,i| %> - -
              -
              - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
              -
              -
              - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
              -
              - <%= reply.comments.html_safe%> -
              -
              - <%= format_time(reply.created_on) %> - -
              -

              -
              -
              -
              - <% end %> -
              - - <% end %> -
              - <% if @news.commentable? %> -
              - -
              -
              - <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> -
              - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :comments, :editor_id => 'comment_editor', - :owner_id => @comment.nil? ? 0: @comment.id, - :owner_type => OwnerTypeHelper::COMMENT, - :width => '99%', - :height => 100, - :minHeight=>100, - :input_html => { :id => 'comment_content', - :class => 'talk_text fl', - :maxlength => 5000 }%> -
              -

              -

              - - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

              - <% end %> -
              -
              -
              - <% end %> -
              -
              - +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + + +
              +
              +
              + <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> +
              +
              + <% if User.current.logged? %> + + <%end%> + +
              + +
              + <% if @news.try(:author).try(:realname) == ' ' %> + <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
              +
              <%= format_time( @news.created_on)%>
              +
              +
              + <%= @news.description.html_safe%> +
              +
              +
              + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %> +
              +
              +
              +
              +
              +
              + <% unless @comments.empty? %> +
              +
              回复(<%=@comments.count %>)
              +
              +
              +
              + <% @comments.each_with_index do |reply,i| %> + +
              +
              + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
              +
              +
              + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
              +
              + <%= reply.comments.html_safe%> +
              +
              + <%= format_time(reply.created_on) %> + +
              +

              +
              +
              +
              + <% end %> +
              + + <% end %> +
              + <% if @news.commentable? %> +
              + +
              +
              + <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
              + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
              +

              +

              + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

              + <% end %> +
              +
              +
              + <% end %> +
              +
              + diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 144b93b28..74378e3fd 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -184,8 +184,13 @@
              From d6e248805f6176c5067cf9c0d9cf3e7ec17b9a73 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 11:37:48 +0800 Subject: [PATCH 868/913] =?UTF-8?q?changeset=5Fnum=20nil=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9f516ae1a..d15d350e6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -67,7 +67,7 @@ module ApplicationHelper # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj - score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 + score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 end # 获取组织成员中文名字 From f3a0e71ceeb5e5e73dd855391e36943812641f72 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 11:38:04 +0800 Subject: [PATCH 869/913] =?UTF-8?q?issue=E4=B8=AD=E5=9B=9E=E5=A4=8Dat?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=8D=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/add_journal.js.erb | 4 ++-- app/views/issues/add_reply.js.erb | 2 +- app/views/issues/delete_journal.js.erb | 2 +- app/views/issues/reply.js.erb | 2 +- app/views/issues/update.js.erb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 9099c31b6..48a9b012e 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -2,7 +2,7 @@ $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') - sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>"); issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, @@ -18,7 +18,7 @@ "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') - sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>"); <%else%> $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); diff --git a/app/views/issues/add_reply.js.erb b/app/views/issues/add_reply.js.erb index 0ee9d30e7..500451781 100644 --- a/app/views/issues/add_reply.js.erb +++ b/app/views/issues/add_reply.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/delete_journal.js.erb b/app/views/issues/delete_journal.js.erb index 63a1a5f96..7c7f25c1c 100644 --- a/app/views/issues/delete_journal.js.erb +++ b/app/views/issues/delete_journal.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/reply.js.erb b/app/views/issues/reply.js.erb index 316c078f2..2d42475f6 100644 --- a/app/views/issues/reply.js.erb +++ b/app/views/issues/reply.js.erb @@ -2,7 +2,7 @@ if($("#reply_message_<%= @jour.id%>").length > 0) { $("#reply_message_<%= @jour.id%>").replaceWith("<%= escape_javascript(render :partial => 'issues/issue_reply_ke_form') %>"); $(function(){ $('input[name=quote]').val("<%= raw escape_javascript(@tempContent.html_safe) %>"); - sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>"); }); }else if($("#reply_to_message_<%= @issue.id%>").length >0) { $("#reply_to_message_<%= @issue.id%>").replaceWith("

              "); diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb index ede4a0534..16ca863e4 100644 --- a/app/views/issues/update.js.erb +++ b/app/views/issues/update.js.erb @@ -5,7 +5,7 @@ $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/e $("#issue_detail").show(); $("#issue_edit").hide(); $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); $(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') //edit里的编辑器貌似显示不出来,所以手动js生成。 issue_desc_editor = KindEditor.create('#issue_description', From 28035dfc47ed9a6742923b0403ed294f90fdc909 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 12:40:00 +0800 Subject: [PATCH 870/913] =?UTF-8?q?=E5=AD=90=E5=9F=9F=E5=90=8D=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../initializers/elasticsearch_dev_patch.rb | 4 +-- config/initializers/subdomain.rb | 27 ++++++++++++++++--- config/routes.rb | 18 ++++++------- db/schema.rb | 11 +++++++- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/config/initializers/elasticsearch_dev_patch.rb b/config/initializers/elasticsearch_dev_patch.rb index 4eda95ee5..ac9b800ba 100644 --- a/config/initializers/elasticsearch_dev_patch.rb +++ b/config/initializers/elasticsearch_dev_patch.rb @@ -10,7 +10,7 @@ if Rails.env.development? class NoObject instance_methods.each do |m| - undef_method(m) unless [:undef_method, :method_missing].include?(m) + undef_method(m) unless [:object_id, :__send__, :undef_method, :method_missing].include?(m) end def method_missing(method, *args, &block) @@ -50,4 +50,4 @@ if Rails.env.development? end end -end \ No newline at end of file +end diff --git a/config/initializers/subdomain.rb b/config/initializers/subdomain.rb index b868e7e0b..474503339 100644 --- a/config/initializers/subdomain.rb +++ b/config/initializers/subdomain.rb @@ -1,9 +1,30 @@ class Subdomain + def initialize(opt={}) + @opt = {}.merge(opt) + end + def matches?(request) - o = Organization.where(domain: request.subdomain).first - request.path_parameters[:id] = o.id if o - !o.nil? + puts request.path_parameters + o = Secdomain.where(subname: request.subdomain).first + + if(@opt[:sub]) + if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news' + request.path_parameters[:id] = o.pid + request.path_parameters[:controller] = 'org_subfields' + request.path_parameters[:action] = 'show' + return true + end + end + + + if o && o.controller + request.path_parameters[:id] = o.pid + request.path_parameters[:controller] = o.controller + request.path_parameters[:action] = o.action + return true + end + false end end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 550642120..f4d8daf4f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,15 @@ RedmineApp::Application.routes.draw do # Enable Grack support # mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] + constraints(Subdomain.new) do + get '/', to: 'organizations#show' + end + + constraints(Subdomain.new(sub: true)) do + get '/:sub_dir_name', to: 'fake#fake' + end + + resources :shield_activities do collection do delete 'show_acts' @@ -75,16 +84,7 @@ RedmineApp::Application.routes.draw do end - constraints(Subdomain.new) do - get '/', to: 'organizations#show' - end - get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} - get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} - get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'} - get '/', to: 'users#show', defaults: {id: 7}, constraints: {subdomain: 'whm'} - get '/', to: 'users#show', defaults: {id: 5}, constraints: {subdomain: 'yg'} - get '/', to: 'users#show', defaults: {id:11}, constraints: {subdomain: 'wt'} resources :org_member do member do diff --git a/db/schema.rb b/db/schema.rb index 2e5bfde22..7b68815a8 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 => 20160128024452) do +ActiveRecord::Schema.define(:version => 20160202034530) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1534,6 +1534,15 @@ ActiveRecord::Schema.define(:version => 20160128024452) do t.string "pinyin" end + create_table "secdomains", :force => true do |t| + t.integer "sub_type" + t.string "subname" + t.integer "pid", :default => 0 + t.string "desc" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "seems_rateable_cached_ratings", :force => true do |t| t.integer "cacheable_id", :limit => 8 t.string "cacheable_type" From dab99eb044f06ce78db5d809228706ae5a65209a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 2 Feb 2016 13:38:37 +0800 Subject: [PATCH 871/913] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=A1=86=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/show.html.erb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index e59c8359d..3d52206a4 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -3,19 +3,6 @@ <%= javascript_include_tag 'forum' %> <% end %> - - \ No newline at end of file diff --git a/app/views/users/user_import_homeworks.js.erb b/app/views/users/user_import_homeworks.js.erb index 3be46e119..ac6665800 100644 --- a/app/views/users/user_import_homeworks.js.erb +++ b/app/views/users/user_import_homeworks.js.erb @@ -1,4 +1,6 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>'); showModal('ajax-modal', '1040px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +var mTop = ($(window).height()-646)/2; +var mLeft = ($(window).width()-1054)/2; +$('#ajax-modal').parent().css("border","3px solid #269ac9").css("top","mTop").css("left","mLeft").css("position","fixed"); \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 32370c4a7..8951e8c1f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1374,7 +1374,6 @@ ActiveRecord::Schema.define(:version => 20160128024452) do t.integer "changeset_num", :default => 0 t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 - t.integer "act_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" end @@ -1863,25 +1862,6 @@ ActiveRecord::Schema.define(:version => 20160128024452) do add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - create_table "user_wechats", :force => true do |t| - t.integer "subscribe" - t.string "openid" - t.string "nickname" - t.integer "sex" - t.string "language" - t.string "city" - t.string "province" - t.string "country" - t.string "headimgurl" - t.string "subscribe_time" - t.string "unionid" - t.string "remark" - t.integer "groupid" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false @@ -1957,14 +1937,6 @@ ActiveRecord::Schema.define(:version => 20160128024452) do t.datetime "updated_at", :null => false end - create_table "wechat_logs", :force => true do |t| - t.string "openid", :null => false - t.text "request_raw" - t.text "response_raw" - t.text "session_raw" - t.datetime "created_at", :null => false - end - create_table "wiki_content_versions", :force => true do |t| t.integer "wiki_content_id", :null => false t.integer "page_id", :null => false From ea8e73ad54931382763141976d0eb1696839bf7c Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 2 Feb 2016 15:47:12 +0800 Subject: [PATCH 873/913] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E7=9A=84=E6=8B=96?= =?UTF-8?q?=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_show_user_homeworks.html.erb | 2 +- app/views/users/user_import_homeworks.js.erb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index 9f90a633f..d2b3f286d 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -1,4 +1,4 @@ -
              +
              选用题库中的题目
              公共题库 diff --git a/app/views/users/user_import_homeworks.js.erb b/app/views/users/user_import_homeworks.js.erb index 3be46e119..d1cb29faa 100644 --- a/app/views/users/user_import_homeworks.js.erb +++ b/app/views/users/user_import_homeworks.js.erb @@ -1,4 +1,5 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>'); showModal('ajax-modal', '1040px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9"); +$('#ajax-modal').css("margin","15px"); From d42f144f23be556cf9c9f7851143d70ca13af05b Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 2 Feb 2016 15:50:28 +0800 Subject: [PATCH 874/913] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=B8=96=E5=AD=90=E6=8F=8F=E8=BF=B0=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A2=9E=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/edit.html.erb | 8 +- app/views/homework_common/index.html.erb | 8 +- app/views/org_document_comments/edit.html.erb | 22 +-- app/views/org_document_comments/new.html.erb | 25 ++-- app/views/users/_user_homework_form.html.erb | 128 ++++++++++++++++- app/views/users/user_homeworks.html.erb | 8 +- public/javascripts/des_kindEditor.js | 136 ++++++++++++++++++ 7 files changed, 303 insertions(+), 32 deletions(-) create mode 100644 public/javascripts/des_kindEditor.js diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index ac772171d..f95739f26 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -5,7 +5,11 @@ $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } function cancel_edit(){ @@ -26,7 +30,7 @@
              -
              +
              <%= form_for @homework do |f| %> diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 5c91a37fc..ac4ac9853 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -6,7 +6,11 @@ document.getElementById("anonymous_comment").checked = true; $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } @@ -44,7 +48,7 @@ <% if @is_teacher%> -
              +
              <%= labelled_form_for @new_homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
              <%= render :partial => 'users/user_homework_form', :locals => { :homework => @new_homework,:f => f,:edit_mode => false,:select_course => false } %> diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 1b807220d..b17ae0e75 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -1,9 +1,13 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= javascript_include_tag "des_KindEditor" %> <% end %> -<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> -
              -
              +
              + <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> +
              -
              -
              +
              +
              +
              - <%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> + + <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>

              @@ -49,12 +55,11 @@
              - 确定 + 确定 - 取消 + 取消
              -
              + <% end %>
              -<% end %> \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index cc7e4bb8e..7a5bd8f27 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -23,6 +23,119 @@ $("#anonymous_comment").val(0); } } + function nh_reset_homework_form(params){ + if(params.textarea.html() != "") { + cancel_edit(); + } else { + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + } + } + function init_homework_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = false; + checked_val(); + if(!regex_homework_name()){ + $("#homework_name").focus(); + } + else if(!regex_homework_end_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_homework_end_publish_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_course_id()){ + $("#course_id").focus(); + } + else{ + params.textarea.html(params.editor.html()); + params.editor.sync(); + is_checked = 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 init_homework_editor(params){ + params.textarea.removeAttr('placeholder'); + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + var edit = this.edit; + var body = edit.doc.body; + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + var body = edit.doc.body; + edit.html(params.textarea.innerHTML); + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); + + } + }).loadPlugin('paste'); + return editor; + } + KindEditor.ready(function(K){ + $("div[nhname='homework_common_form']").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='homework_textarea']",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_homework_editor(params); + init_homework_form(params); + params.submit_btn.click(function () { + params.form.submit(); + }); + params.cancel_btn.click(function () { + reset_homework(); + nh_reset_homework_form(params); + }); + params.textarea.data('init', 1); + } + }); + }); <% end %> @@ -70,10 +183,12 @@
              <% if edit_mode %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> <% else %> <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> <% end %>
              @@ -89,17 +204,16 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
              -
              <% if edit_mode %> - 确定 + 确定 <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%> - 取消 + 取消 <% else %> - 发送 + 发送 - 取消 + 取消 <% end %>
              diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index 7be803720..d0adb291f 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -5,7 +5,11 @@ $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } @@ -29,7 +33,7 @@ <% if @is_teacher%> -
              +
              <% homework = HomeworkCommon.new %> <% homework.homework_detail_manual = HomeworkDetailManual.new%> <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %> diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js new file mode 100644 index 000000000..1b952672a --- /dev/null +++ b/public/javascripts/des_kindEditor.js @@ -0,0 +1,136 @@ +function init_des_editor(params){ + // var minHeight; //最小高度 + var paramsHeight = params.height; //设定的高度 + var paramsWidth = params.width == undefined ? "100%" : params.width; + + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:paramsWidth, + height:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px", + minHeight:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + //nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + var edit = this.edit; + var body = edit.doc.body; + edit.iframe.height(paramsHeight); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, paramsHeight)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + edit.html(params.textarea.innerHTML); + var body = edit.doc.body; + paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; + edit.iframe.height(paramsHeight); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight), paramsHeight)); + + } + }).loadPlugin('paste'); + return editor; +} + +function nh_check_field(params){ + var result=true; + if(!check_org_title()) { + result=false; + return result; + } + 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'}); + } + } + } + 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, + //title:params.texttitle, + content:params.editor, + //titlemsg:params.titlemsg, + 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.texttitle.empty(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); + params.titlemsg.html(""); +} +//第二个参数是高度,可以传,可以不传 +function init_des_data(){ + var height = arguments[0] ? arguments[0] : undefined; + var width = arguments[1] ? arguments[1] : undefined; + KindEditor.ready(function (K) { + $("div[nhname='new_topic_form']").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.texttitle = $("#document_title", params.div_form); + params.textarea = $("textarea[nhname='description_textarea']", params.div_form); + //params.titlemsg = $("#doc_title_hint", params.div_form); + params.contentmsg = $("#homework_course_id_span", params.div_form); + params.cancel_btn = $("#new_topic_cancel_btn"); + params.submit_btn = $("#new_topic_submit_btn"); + params.height = height; + params.width = width; + if (params.textarea.data('init') == undefined) { + params.editor = init_des_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(); + } + }); + }); +} \ No newline at end of file From ed2a3c976d8a6d122222f287407d8e3e4d23b3dd Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 16:25:26 +0800 Subject: [PATCH 875/913] =?UTF-8?q?=E6=89=A7=E8=A1=8Ctask=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E4=BB=A3=E5=85=A5=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/elasticsearch_batch_op.rake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake index 91c2ddff9..034887373 100644 --- a/lib/tasks/elasticsearch_batch_op.rake +++ b/lib/tasks/elasticsearch_batch_op.rake @@ -1,12 +1,12 @@ namespace :importer do - task :importuser do + task :importuser => :environment do ENV['CLASS']='User' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' Rake::Task["elasticsearch:import:model"].invoke end - task :importproject do + task :importproject => :environment do ENV['CLASS']='Project' ENV['SCOPE']='indexable' @@ -14,21 +14,21 @@ namespace :importer do ENV['BATCH']='1000' Rake::Task["elasticsearch:import:model"].invoke end - task :importcourse do + task :importcourse => :environment do ENV['CLASS']='Course' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' Rake::Task["elasticsearch:import:model"].invoke end - task :importattachment do + task :importattachment => :environment do ENV['CLASS']='Attachment' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' Rake::Task["elasticsearch:import:model"].invoke end - task :importmemo do + task :importmemo => :environment do ENV['CLASS']='Memo' ENV['SCOPE']='indexable' ENV['FORCE']='y' From 609d98f8a3dbafd37f106c2b9e816f143dfb763f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 16:33:08 +0800 Subject: [PATCH 876/913] =?UTF-8?q?=E6=89=A7=E8=A1=8Ctask=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E4=BB=A3=E5=85=A5=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/elasticsearch_batch_op.rake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake index 034887373..4be382367 100644 --- a/lib/tasks/elasticsearch_batch_op.rake +++ b/lib/tasks/elasticsearch_batch_op.rake @@ -1,4 +1,11 @@ namespace :importer do + task :import_all => :environment do + Rake::Task["importer:importuser"].execute + Rake::Task["importer:importproject"].execute + Rake::Task["importer:importcourse"].execute + Rake::Task["importer:importattachment"].execute + Rake::Task["importer:importmemo"].execute + end task :importuser => :environment do ENV['CLASS']='User' ENV['SCOPE']='indexable' From eed62501451aca017d8513a7b5051ed2a975f991 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 17:36:11 +0800 Subject: [PATCH 877/913] =?UTF-8?q?secdomain=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/subdomain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/subdomain.rb b/config/initializers/subdomain.rb index 474503339..f813a24a0 100644 --- a/config/initializers/subdomain.rb +++ b/config/initializers/subdomain.rb @@ -6,7 +6,7 @@ class Subdomain def matches?(request) puts request.path_parameters - o = Secdomain.where(subname: request.subdomain).first + o = ::Secdomain.where(subname: request.subdomain).first if(@opt[:sub]) if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news' From 7f8f3fa15230cba9e9b6250ead642dfbe2710833 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 18:47:53 +0800 Subject: [PATCH 878/913] =?UTF-8?q?=E8=A2=ABrubymine=E5=9D=91=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E8=BF=99=E4=B8=A4=E4=B8=AA=E6=96=87=E4=BB=B6=E6=B2=A1?= =?UTF-8?q?=E5=8A=A0=E8=BF=9B=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/secdomain.rb | 18 ++++++++++++ .../20160202034530_create_secdomains.rb | 28 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 app/models/secdomain.rb create mode 100644 db/migrate/20160202034530_create_secdomains.rb diff --git a/app/models/secdomain.rb b/app/models/secdomain.rb new file mode 100644 index 000000000..4d0abe5db --- /dev/null +++ b/app/models/secdomain.rb @@ -0,0 +1,18 @@ +class Secdomain < ActiveRecord::Base + attr_accessible :pid, :subname, :sub_type, :desc + + validates_presence_of :subname, :sub_type + validates_uniqueness_of :subname + + def controller + return 'organizations' if sub_type == 2 + return 'users' if sub_type == 3 + nil + end + + def action + return 'show' if sub_type == 2 + return 'show' if sub_type == 3 + nil + end +end diff --git a/db/migrate/20160202034530_create_secdomains.rb b/db/migrate/20160202034530_create_secdomains.rb new file mode 100644 index 000000000..49650d073 --- /dev/null +++ b/db/migrate/20160202034530_create_secdomains.rb @@ -0,0 +1,28 @@ +class CreateSecdomains < ActiveRecord::Migration + def change + create_table :secdomains do |t| + t.integer :sub_type #1.系统预留 2.Organization 3.users + t.string :subname #子域名 + t.integer :pid, default: 0 #参数id + t.string :desc + + t.timestamps + end + + #系统保留 + Secdomain.create(sub_type: 1, subname: 'gitlab') + Secdomain.create(sub_type: 1, subname: 'wechat') + Secdomain.create(sub_type: 1, subname: 'judge') + + #organization + Secdomain.create(sub_type: 2, subname: 'micros', pid: 5) + Secdomain.create(sub_type: 2, subname: 'nubot', pid: 23) + Secdomain.create(sub_type: 2, subname: 'team', pid: 1) + + #users + Secdomain.create(sub_type: 3, subname: 'whm', pid: 7) + Secdomain.create(sub_type: 3, subname: 'yg', pid: 5) + Secdomain.create(sub_type: 3, subname: 'wt', pid: 11) + + end +end From eb3644a197caf5fc3c4df1af6f725996c363a22c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 19:16:15 +0800 Subject: [PATCH 879/913] =?UTF-8?q?=E5=B0=86=E4=B8=80=E5=A0=86=E7=9A=84rak?= =?UTF-8?q?e=E5=91=BD=E4=BB=A4=E5=8F=98=E4=B8=BA=E4=B8=80=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/elasticsearch_batch_op.rake | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake index 4be382367..b9933cf75 100644 --- a/lib/tasks/elasticsearch_batch_op.rake +++ b/lib/tasks/elasticsearch_batch_op.rake @@ -1,17 +1,11 @@ namespace :importer do - task :import_all => :environment do - Rake::Task["importer:importuser"].execute - Rake::Task["importer:importproject"].execute - Rake::Task["importer:importcourse"].execute - Rake::Task["importer:importattachment"].execute - Rake::Task["importer:importmemo"].execute - end + task :importuser => :environment do ENV['CLASS']='User' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end task :importproject => :environment do @@ -19,27 +13,30 @@ namespace :importer do ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end task :importcourse => :environment do ENV['CLASS']='Course' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end task :importattachment => :environment do ENV['CLASS']='Attachment' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end task :importmemo => :environment do ENV['CLASS']='Memo' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end + + desc "Run all tasks" + task :all => [:importuser,:importproject,:importcourse,:importattachment,:importmemo] end \ No newline at end of file From 1f7bcbed20ef8f63fad191ab166fc8266d74b290 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 21:28:52 +0800 Subject: [PATCH 880/913] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=A2=98=E5=BA=93=E6=A0=87=E9=A2=98=E4=B8=AD=E7=9A=84=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/import_fix.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/tasks/import_fix.rake diff --git a/lib/tasks/import_fix.rake b/lib/tasks/import_fix.rake new file mode 100644 index 000000000..e5bd1a796 --- /dev/null +++ b/lib/tasks/import_fix.rake @@ -0,0 +1,14 @@ +namespace :import do + desc "fix import name" + task :fix => :environment do + HomeworkCommon.find_each do |homework| + name = homework.name.sub("\n", " ").sub("\r\n", " ") + if name != homework.name + homework.name = name + homework.save! + end + + end + end + +end From 0a0d67642a090781a86f921c2e83ffb8fc465e16 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 3 Feb 2016 12:17:45 +0800 Subject: [PATCH 881/913] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_form.html.erb | 2 ++ app/views/users/user_select_homework.js.erb | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 7a5bd8f27..0d542882a 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -16,6 +16,7 @@ $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); + var homework_description_editor; function checked_val() { if ($("#anonymous_comment").is(":checked")) { $("#anonymous_comment").val(1); @@ -124,6 +125,7 @@ params.submit_btn = $("#new_message_submit_btn"); if(params.textarea.data('init') == undefined) { params.editor = init_homework_editor(params); + homework_description_editor = params.editor; init_homework_form(params); params.submit_btn.click(function () { params.form.submit(); diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 306374b84..21fd9db26 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -8,11 +8,13 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); $("#ref_homework_id").val("<%= @ref_homework.id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); -<% if @homework_detail_group %> +//$("input[name='homework_type']").val("<%#= @homework.homework_type%>"); +<% if @homework_detail_programing %> + $("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); + $("#BluePopupBox a.BlueCirBtn").click(); +<% elsif @homework_detail_group %> $('span.group_detail_info').text('分组人数:<%=@homework_detail_group.min_num %>-<%=@homework_detail_group.max_num %> 人'); + $("#GroupPopupBox").html("<%=escape_javascript( render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); + $("#GroupPopupBox a.group_save_btn").click(); <% end %> -$("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); -$("#GroupPopupBox").html("<%=escape_javascript( render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); -//$("input[name='homework_type']").val("<%#= @homework.homework_type%>"); $("#homework_editor").show(); -$("#BluePopupBox a.BlueCirBtn").click(); From 02f80075576e40c05b0987cc22686297ba3f2474 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 3 Feb 2016 12:42:42 +0800 Subject: [PATCH 882/913] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9A=84=E6=A0=B7=E5=BC=8F=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_home_page.html.erb | 2 +- public/stylesheets/org.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index f447c5022..0e725532e 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -50,7 +50,7 @@