From 945192f1d81153752cbfb83fe6f89e1dbe06669e Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Tue, 21 Apr 2015 09:41:40 +0800 Subject: [PATCH 001/134] =?UTF-8?q?=E6=B7=BB=E5=8A=A0memcached=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20Signed-off-by:=20alanlong9278=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- config/environments/development.rb | 3 +- config/environments/production.rb | 3 +- db/schema.rb | 2925 ++++++++++++++-------------- 4 files changed, 1464 insertions(+), 1469 deletions(-) diff --git a/Gemfile b/Gemfile index 976184793..887676c31 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem 'spreadsheet' gem 'ruby-ole' #gem 'email_verifier', path: 'lib/email_verifier' gem 'rufus-scheduler' -#gem 'dalli', path: 'lib/dalli-2.7.2' +gem 'dalli' gem 'rails_kindeditor',path:'lib/rails_kindeditor' group :development do gem 'grape-swagger' diff --git a/config/environments/development.rb b/config/environments/development.rb index 5c2427320..d3843ff68 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -11,7 +11,8 @@ RedmineApp::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false - config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" + #config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" + config.cache_store = :dalli_store # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 160e0b8b0..d52d5840a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,7 +19,8 @@ RedmineApp::Application.configure do # Full error reports are disabled and caching is turned on config.logger = Logger.new('log/production.log', 'daily',1048576) # daily, weekly or monthly config.action_controller.perform_caching = true - config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" + config.cache_store = :dalli_store + #config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/db/schema.rb b/db/schema.rb index e4c11e8ce..184f959c0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,1466 +1,1459 @@ -# 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 => 20150415032102) 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 - 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 "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 "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_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_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_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 - 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 "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 "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 "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 - - 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 - - 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 "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" - 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 "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 "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 - 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" - 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 "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 "organizations", :force => true do |t| - t.string "name" - t.string "logo_link" - 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 "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" - 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 - 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" - 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 "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 - - 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_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" - 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 - 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 "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 +# 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 => 20150415032102) 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 + 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 "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 "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_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_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_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 + 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 "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 "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 "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 "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 + + 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 + + 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 "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" + 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 "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 "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 + 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" + 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 "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 "organizations", :force => true do |t| + t.string "name" + t.string "logo_link" + 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 "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" + 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 + 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" + 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 "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 + + 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_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" + 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 + 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 "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 54078e114c00c4a5a1d2f867d673c9a97e79a94d Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 4 May 2015 15:20:40 +0800 Subject: [PATCH 002/134] =?UTF-8?q?redis=E7=BC=93=E5=AD=98=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E7=9A=84=E6=90=AD=E5=BB=BA=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=AF=B9=E9=A6=96=E9=A1=B5=E7=9A=84=E7=BC=93=E5=AD=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 ++ app/controllers/welcome_controller.rb | 2 +- config/additional_environment.rb.example | 10 ---------- config/environments/development.rb | 6 +++--- config/initializers/redis.rb | 1 + db/schema.rb | 17 ----------------- 6 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 config/additional_environment.rb.example create mode 100644 config/initializers/redis.rb diff --git a/Gemfile b/Gemfile index 13b410d9d..d3fb6de22 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,8 @@ gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' gem 'spreadsheet' gem 'ruby-ole' +gem 'redis' +gem 'redis-store' gem 'rails_kindeditor',path:'lib/rails_kindeditor' group :development do gem 'grape-swagger' diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f35210f01..df006c9b4 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -19,7 +19,7 @@ class WelcomeController < ApplicationController include ApplicationHelper include WelcomeHelper helper :project_score - caches_action :robots + caches_action :robots, :course, :contest, :index, expires_in: 2.hours, layout: false #before_filter :find_first_page, :only => [:index] # before_filter :fake, :only => [:index, :course] before_filter :entry_select, :only => [:index] diff --git a/config/additional_environment.rb.example b/config/additional_environment.rb.example deleted file mode 100644 index 2a317a396..000000000 --- a/config/additional_environment.rb.example +++ /dev/null @@ -1,10 +0,0 @@ -# Copy this file to additional_environment.rb and add any statements -# that need to be passed to the Rails::Initializer. `config` is -# available in this context. -# -# Example: -# -# config.log_level = :debug -# ... -# - diff --git a/config/environments/development.rb b/config/environments/development.rb index d3843ff68..2aca152cb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,9 +10,9 @@ RedmineApp::Application.configure do config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_controller.perform_caching = false - #config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" - config.cache_store = :dalli_store + config.action_controller.perform_caching = true + config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" + #config.cache_store = :dalli_store # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb new file mode 100644 index 000000000..4aa95a27b --- /dev/null +++ b/config/initializers/redis.rb @@ -0,0 +1 @@ +$redis = Redis.new(:host => "127.0.0.1", :port => 6379) \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 7fb01a8aa..95766c5c2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -438,13 +438,6 @@ ActiveRecord::Schema.define(:version => 20150428021035) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -654,16 +647,6 @@ ActiveRecord::Schema.define(:version => 20150428021035) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From 14a4cfa0dbaea916bf8ac4ddde031de57367127b Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 4 May 2015 16:25:00 +0800 Subject: [PATCH 003/134] Signed-off-by: alan <547533434@qq.com> --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 4a0e56115..9e7a2ba81 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,7 +31,7 @@ module RedmineApp end # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += %W(#{config.root}/lib) - + config.autoload_paths += %w(#{RAILS_ROOT}/app/sweepers) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. # config.plugins = [ :exception_notification, :ssl_requirement, :all ] From 49d836d3314ac2c3a445818e124b2f66d5908c64 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 May 2015 23:47:22 +0800 Subject: [PATCH 004/134] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=92=8C=E5=9B=BE=E7=89=87=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=9C=A8=E5=90=8E=E5=8F=B0=E5=8A=A0=E5=85=A5=E9=99=90=E5=88=B6?= =?UTF-8?q?,=E4=B8=94=E9=80=9A=E8=BF=87=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 64 +++++++++++++++----------- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + lib/trustie/utils/image.rb | 28 ++++++++++- public/javascripts/jq-upload/upload.js | 15 ++++-- spec/requests/course_request_spec.rb | 42 ++++++++++++++++- 6 files changed, 118 insertions(+), 33 deletions(-) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index ef7cdf2f7..afd206c92 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -1,9 +1,9 @@ class AvatarController < ApplicationController - - + + include ActionView::Helpers::NumberHelper #before_filter :set_cache_buster include AvatarHelper - + def upload # Make sure that API users get used to set this content type # as it won't trigger Rails' automatic parsing of the request body for parameters @@ -29,43 +29,51 @@ class AvatarController < ApplicationController end if @temp_file && (@temp_file.size > 0) - diskfile=disk_filename(@source_type,@source_id) - @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) + if @temp_file.size > Setting.upload_avatar_max_size.to_i + @status = 1 + @msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)) + elsif Trustie::Utils::Image.new(@temp_file.tempfile.path).image? + diskfile=disk_filename(@source_type,@source_id) + @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) - # 用户头像上传时进行特别处理 - if @source_type == 'User' + # 用户头像上传时进行特别处理 + if @source_type == 'User' diskfile += "temp" @urlfile += "temp" - end + end - logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)") - path = File.dirname(diskfile) - unless File.directory?(path) - FileUtils.mkdir_p(path) - end - md5 = Digest::MD5.new - File.open(diskfile, "wb") do |f| - if @temp_file.respond_to?(:read) - buffer = "" - while (buffer = @temp_file.read(8192)) - f.write(buffer) - md5.update(buffer) + logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)") + path = File.dirname(diskfile) + unless File.directory?(path) + FileUtils.mkdir_p(path) + end + md5 = Digest::MD5.new + File.open(diskfile, "wb") do |f| + if @temp_file.respond_to?(:read) + buffer = "" + while (buffer = @temp_file.read(8192)) + f.write(buffer) + md5.update(buffer) + end + else + f.write(@temp_file) + md5.update(@temp_file) end - else - f.write(@temp_file) - md5.update(@temp_file) end + + Trustie::Utils::Image.new(diskfile,true).compress(300) + @status = 0 + @msg = '' + else + @status = 2 + @msg = l(:not_valid_image_file) end -# self.digest = md5.hexdigest end @temp_file = nil - image = Trustie::Utils::Image.new(diskfile,true) - image.compress(300) - respond_to do |format| format.json{ - render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html' + render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html' return } format.js diff --git a/config/locales/en.yml b/config/locales/en.yml index 8989ae36a..844818ae4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1521,4 +1521,5 @@ en: label_commit_failed: commit failed #api end error_upload_avatar_to_large: "too big (%{max_size})" + not_valid_image_file: not a valid image file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 5fcb1fb5c..a91faac0f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1984,3 +1984,4 @@ zh: label_code: 代码 error_upload_avatar_to_large: "超过大小限制 (%{max_size})" + not_valid_image_file: 不是有效的图片文件 diff --git a/lib/trustie/utils/image.rb b/lib/trustie/utils/image.rb index 9178b291a..f4ec328b3 100644 --- a/lib/trustie/utils/image.rb +++ b/lib/trustie/utils/image.rb @@ -3,11 +3,37 @@ module Trustie module Utils class Image - def initialize(file, bak) + def initialize(file, bak=false) @file = file @bak = bak end + def bitmap?(data) + data[0,2]==77.chr + 66.chr + end + + def gif?(data) + data[0,4]==71.chr + 73.chr + 70.chr + 56.chr + end + + def jpeg?(data) + data[0,4]== 0xff.chr + 0xd8.chr + 0xff.chr + 0xe0.chr + end + def png?(data) + data[0,2]==0x89.chr + 80.chr + end + + def image? + begin + f = File.open(@file,'rb') # rb means to read using binary + return false if f.size < 9 + data = f.read(9) # magic numbers are up to 9 bytes + return bitmap?(data) || gif?(data) || jpeg?(data) || png?(data) + ensure + f.close + end + end + def compress(size=300) backup if @bak begin diff --git a/public/javascripts/jq-upload/upload.js b/public/javascripts/jq-upload/upload.js index 985450648..71dbefc32 100644 --- a/public/javascripts/jq-upload/upload.js +++ b/public/javascripts/jq-upload/upload.js @@ -44,9 +44,18 @@ $(function() { }, done: function(e, data) { var imgSpan = jQuery('#avatar_image'); - imgSpan.attr({ - "src": data.result.text ? data.result.text() : data.result - }); + var result = data.result.text ? data.result.text() : data.result; + if(result){ + var o = JSON.parse(result); + if(o.status == 0){ + imgSpan.attr({ + "src": o.url + }); + } else { + alert(o.message); + } + } + } }); }); diff --git a/spec/requests/course_request_spec.rb b/spec/requests/course_request_spec.rb index d58df398e..99e4486b0 100644 --- a/spec/requests/course_request_spec.rb +++ b/spec/requests/course_request_spec.rb @@ -35,13 +35,53 @@ RSpec.describe "课程", :type => :request do context "修改课程图片" do include Rack::Test::Methods let(:avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg')} + context "正常图片上传成功" do subject(:resp) {post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: avatar}} it{ expect(subject).to be_ok } it{ expect(subject.body).not_to be_empty } + it "状态要为0" do + o = ActiveSupport::JSON.decode(subject.body) + expect(o["status"]).to eq(0) + end + it "要回传图片地址" do + o = ActiveSupport::JSON.decode(subject.body) + expect(o["url"]).not_to be_empty + end + end + + context "不是图片,上传失败" do + let(:invalid_avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/hah.txt",'text/plain')} + before do + resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: invalid_avatar} + @o = ActiveSupport::JSON.decode(resp.body) + end + it "状态要为0" do + expect(@o["status"]).not_to eq(0) + end + it "要回传错误信息" do + expect(@o["message"]).to be_include("图片") + end + end + + context "文件过大,上传失败" do + before do + big_file = Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg') + allow(ActionDispatch::Http::UploadedFile).to receive(:new).and_return(double('BigFile',size: 10*1024*1024, original_filename: 'rais.jpg', tempfile: nil)) + # trace = TracePoint.new(:call) do |tp| + # p [tp.lineno, tp.defined_class, tp.method_id, tp.event] if tp.method_id == :post + # end + resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),'avatar[image]'=> big_file + @o = ActiveSupport::JSON.decode(resp.body) + end + it "状态要为0" do + expect(@o["status"]).not_to eq(0) + end + it "要回传错误信息" do + expect(@o["message"]).to be_include("大") + end end - it "不是图片,上传失败" end end From d546069051efe627fa2eb234255dadbb04d3c05e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 16 May 2015 09:59:14 +0800 Subject: [PATCH 005/134] =?UTF-8?q?spec=20=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/models/forum_observer_spec.rb | 5 ----- spec/models/memo_observer_spec.rb | 5 ----- spec/requests/course_request_spec.rb | 4 ++-- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 spec/models/forum_observer_spec.rb delete mode 100644 spec/models/memo_observer_spec.rb diff --git a/spec/models/forum_observer_spec.rb b/spec/models/forum_observer_spec.rb deleted file mode 100644 index 76d68fafa..000000000 --- a/spec/models/forum_observer_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe ForumObserver do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/memo_observer_spec.rb b/spec/models/memo_observer_spec.rb deleted file mode 100644 index 82603ba7a..000000000 --- a/spec/models/memo_observer_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe MemoObserver do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/requests/course_request_spec.rb b/spec/requests/course_request_spec.rb index 99e4486b0..feca37259 100644 --- a/spec/requests/course_request_spec.rb +++ b/spec/requests/course_request_spec.rb @@ -56,7 +56,7 @@ RSpec.describe "课程", :type => :request do resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: invalid_avatar} @o = ActiveSupport::JSON.decode(resp.body) end - it "状态要为0" do + it "状态不为0" do expect(@o["status"]).not_to eq(0) end it "要回传错误信息" do @@ -74,7 +74,7 @@ RSpec.describe "课程", :type => :request do resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),'avatar[image]'=> big_file @o = ActiveSupport::JSON.decode(resp.body) end - it "状态要为0" do + it "状态不为0" do expect(@o["status"]).not_to eq(0) end it "要回传错误信息" do From 34893db4650b371ee0436471fedbe2f3e83d0942 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 18 May 2015 14:53:01 +0800 Subject: [PATCH 006/134] Signed-off-by: alan <547533434@qq.com> --- Gemfile | 2 +- app/views/boards/_form_project.html.erb | 52 ++++++++++++++++++++++++- app/views/boards/_project_show.html.erb | 4 +- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index fbe74f8dd..9642e320c 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'acts-as-taggable-on', '2.4.1' gem 'spreadsheet' gem 'ruby-ole' gem 'rails_kindeditor',path:'lib/rails_kindeditor' -gem "rmagick", ">= 2.0.0" +#gem "rmagick", ">= 2.0.0" group :development do gem 'grape-swagger' diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 8288debe2..69f8d7b2c 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -1,3 +1,16 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> + <%= error_messages_for 'message' %> <% replying ||= false %> <% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> @@ -35,15 +48,50 @@
  • + <% unless replying %> <% end %> <%= text_area :quote,:quote,:style => 'display:none' %> +
    <% if replying%> - <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + + <%= f.kindeditor :content, :editor_id => 'message_content_editor', + :width => '89%', + :height => 300, + :input_html => { :id => "message_content#{f.object.id}", + :onkeyup => "regexContent('#{f.object.id}');", + :class => 'talk_text fl', + :placeholder => "最多3000个汉字(或6000个英文字符)", + :maxlength => 5000 }%> + <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.kindeditor :content, :editor_id => 'message_content_editor', + :owner_id => @message.nil? ? 0: @message.id, + :owner_type => OwnerTypeHelper::MESSAGE, + :width => '90%', + :height => 300, + :class => 'talk_text fl', + :input_html => { :id => "message_content#{f.object.id}", + :onkeyup => "regexContent('#{f.object.id}');", + :class => 'talk_text fl', + :placeholder => "最多3000个汉字(或6000个英文字符)", + :maxlength => 5000 }%> + <% end %> +

  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 63bb66a6a..db66b1a7e 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -112,11 +112,11 @@ <% end %> <% replies_all = topic.children. includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").offset(2). + reorder("#{Message.table_name}.id asc").offset(2). all %> <% replies_show = topic.children. includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").limit(2). + reorder("#{Message.table_name}.id asc").limit(2). all %> <% unless replies_show.empty? %> <% reply_count = 0 %> From 9b0602fd9ca506e0d1502951bee9c4383bfd1e96 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 18 May 2015 17:26:50 +0800 Subject: [PATCH 007/134] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=B8=8B=E8=BD=BDspec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/commons/en.yml | 3 ++- config/locales/commons/zh.yml | 3 ++- spec/factories/attachments.rb | 10 ++++++++ spec/factories/homeworks.rb | 17 ++++++++++++++ spec/factories/users.rb | 8 +++++++ spec/requests/zipdown_request_spec.rb | 34 +++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 spec/factories/attachments.rb create mode 100644 spec/factories/homeworks.rb diff --git a/config/locales/commons/en.yml b/config/locales/commons/en.yml index 5eb92f07e..c0e29b797 100644 --- a/config/locales/commons/en.yml +++ b/config/locales/commons/en.yml @@ -113,6 +113,7 @@ en: one: "1 error prohibited this %{model} from being saved" other: "%{count} errors prohibited this %{model} from being saved" messages: + record_invalid: "validate error: %{errors}" inclusion: "is not included in the list" exclusion: "is reserved" invalid: "is invalid" @@ -428,4 +429,4 @@ en: previous: "« Previous" next: "Next »" truncate: "..." - \ No newline at end of file + diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 231c5280a..9ba8cba7a 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -121,6 +121,7 @@ zh: one: "由于发生了一个错误 %{model} 无法保存" other: "%{count} 个错误使得 %{model} 无法保存" messages: + record_invalid: "校验失败: %{errors}" inclusion: "不包含于列表中" exclusion: "是保留关键字" invalid: "是无效的" @@ -435,4 +436,4 @@ zh: last: "末页 »" previous: "« 上一页" next: "下一页 »" - truncate: "..." \ No newline at end of file + truncate: "..." diff --git a/spec/factories/attachments.rb b/spec/factories/attachments.rb new file mode 100644 index 000000000..da8e787ed --- /dev/null +++ b/spec/factories/attachments.rb @@ -0,0 +1,10 @@ +#coding=utf-8 +# +FactoryGirl.define do + factory :attachment do + filename "11.gif" + filesize 296833 + digest "8a74e086d7716f89bc4fbac0606589c7" + disk_directory "2015/05" + end +end diff --git a/spec/factories/homeworks.rb b/spec/factories/homeworks.rb new file mode 100644 index 000000000..208255a8d --- /dev/null +++ b/spec/factories/homeworks.rb @@ -0,0 +1,17 @@ +#coding=utf-8 +# +#:author_id, :budget, :deadline, :name, :description, :homework_type, :password + +FactoryGirl.define do + factory :homework, class: Bid do + name "test homework" + budget 0 + deadline {(Time.now+1.days).strftime('%Y-%m-%d')} + description "description" + homework_type 3 + reward_type 3 + end + + factory :homework_attach, class: HomeworkAttach do + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 2c695b920..4595aacc5 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -6,4 +6,12 @@ FactoryGirl.define do password "foobar111" password_confirmation "foobar111" end + + factory :student, class: User do + login "student" + mail "student@example.com" + password "foobar111" + password_confirmation "foobar111" + end + end diff --git a/spec/requests/zipdown_request_spec.rb b/spec/requests/zipdown_request_spec.rb index eb179f104..72831d26f 100644 --- a/spec/requests/zipdown_request_spec.rb +++ b/spec/requests/zipdown_request_spec.rb @@ -1,6 +1,40 @@ require 'rails_helper' +require 'shared_account_spec' +# "attachments"=>{"1"=>{"filename"=>"11.gif", "description"=>"", "is_public_checkbox"=>"1", "token"=>"33731.8a74e086d7716f89bc4fbac0606589c7"}} RSpec.describe "作业打包下载", :type => :request do + let(:student){FactoryGirl.create(:student)} describe "单独下载某学生作业" do + include_context "create user" + before { + FactoryGirl.create(:user) + shared_login + @homework = FactoryGirl.create(:homework, author_id: current_user.id) + + @attch = HomeworkAttach.new + @attch.bid_id = @homework.id + @attch.user_id = student.id + @attachment = Attachment.new(:file => File.open(File.join(Rails.root, "spec/fixtures/test.jpg"))) + @attachment.author = User.current + @attachment.container_type = 'HomeworkAttach' + @attachment.container_id = @attch.id + @attachment.filename = "test.jpg" + @attachment.save + params = {"1"=>{"filename" => "test.jpg", "description" =>"", + "is_public_checkbox"=>"1", + "token" => "#{@attachment.id}.#{@attachment.digest}" } + } + @attch.save_attachments(params) + @attch.name = "test.jpg" + @attch.save! + } + it "正常下载" do + uu = current_user + allow(uu).to receive(:admin?).and_return(true) + allow(User).to receive(:current).and_return(uu) + get zipdown_download_user_homework_path, {homework:@attch.id} + expect(response).to have_http_status(:success) + expect(response.content_type).to eq(Mime::Type.new("applcation/zip",:zip)) + end end end From 1355dc805f45ec643624f160914681d6a6f71e80 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 18 May 2015 17:31:53 +0800 Subject: [PATCH 008/134] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E500=E9=94=99=E8=AF=AF=20#2610?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 1f74ccd5d..269017eb8 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -199,7 +199,7 @@ <% end %> - <% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation.empty? %> + <% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation %> <%= l(:field_occupation) %>: From e3633e702c22138ccfdf8d9986d11479ac4a4150 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 19 May 2015 08:53:51 +0800 Subject: [PATCH 009/134] =?UTF-8?q?firefox=E6=A0=B7=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index edde12527..c0ad5f93c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2782,3 +2782,4 @@ div.repos_explain{ padding-bottom: 20px; } .upload_img img{max-width: 100%;} +#activity .upload_img img{width: 580px;} From ff6173c5f544e243f18016b2290afc9f48699961 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 19 May 2015 09:04:42 +0800 Subject: [PATCH 010/134] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2623:=E7=95=99?= =?UTF-8?q?=E8=A8=80=E2=80=94=E5=88=A0=E9=99=A4=E7=95=99=E8=A8=80=EF=BC=9A?= =?UTF-8?q?=E5=BD=93=E7=95=99=E8=A8=80=E6=88=90=E5=8A=9F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E7=95=99=E8=A8=80=E7=9A=84=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=89=8B=E5=8A=A8=E5=88=B7=E6=96=B0=E6=89=8D?= =?UTF-8?q?=E4=BC=9A=E6=94=B9=E5=8F=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 3 +++ app/views/words/destroy.js.erb | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 3d6772ea8..cc6c4f47e 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -85,6 +85,9 @@ class WordsController < ApplicationController elsif @journal_destroyed.jour_type == "Course" @course = Course.find @journal_destroyed.jour_id @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count + elsif @journal_destroyed.jour_type == "Principal" + @user = User.find(@journal_destroyed.jour_id) + @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count end respond_to do |format| format.js diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 43da9a7d8..dabd3a8c7 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -5,6 +5,8 @@ $('#jours_count').html("<%= @jours_count %>"); <% elsif @course && @jours_count%> $('#course_jour_count').html("(<%= @jours_count %>)"); + <% elsif @user && @jours_count%> + $('#jour_count').html("<%= @jours_count %>"); <% end %> var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') destroyedItem.fadeOut(600,function(){ From d42fd98dffe9249cb54c8366c6e2581e29413bba Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 19 May 2015 10:10:52 +0800 Subject: [PATCH 011/134] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/_base_development_group.html.erb | 52 -- app/views/layouts/_base_friend_group.html.erb | 29 -- .../layouts/_base_research_team.html.erb | 40 -- app/views/layouts/_join_exit_project.html.erb | 1 - app/views/layouts/base_projects.html.erb | 458 +++++++++--------- .../projects/_development_group.html.erb | 52 ++ app/views/projects/_friend_group.html.erb | 29 ++ app/views/projects/_research_team.html.erb | 40 ++ 8 files changed, 349 insertions(+), 352 deletions(-) delete mode 100644 app/views/layouts/_base_development_group.html.erb delete mode 100644 app/views/layouts/_base_friend_group.html.erb delete mode 100644 app/views/layouts/_base_research_team.html.erb create mode 100644 app/views/projects/_development_group.html.erb create mode 100644 app/views/projects/_friend_group.html.erb create mode 100644 app/views/projects/_research_team.html.erb diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb deleted file mode 100644 index 218fc186d..000000000 --- a/app/views/layouts/_base_development_group.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - - <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - - <% end %> - <% unless @project.enabled_modules.where("name = 'boards'").empty? %> - - <% end%> - <% unless @project.enabled_modules.where("name = 'files'").empty? %> - - <% end %> - <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> - <% if visible_repository?(@project) %> - - <% end %> - - - \ No newline at end of file diff --git a/app/views/layouts/_base_friend_group.html.erb b/app/views/layouts/_base_friend_group.html.erb deleted file mode 100644 index d1d7c530a..000000000 --- a/app/views/layouts/_base_friend_group.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - - <% unless @project.enabled_modules.where("name = 'boards'").empty? %> - - <% end%> - <% unless @project.enabled_modules.where("name = 'files'").empty? %> - - <% end %> \ No newline at end of file diff --git a/app/views/layouts/_base_research_team.html.erb b/app/views/layouts/_base_research_team.html.erb deleted file mode 100644 index 83f6a78bb..000000000 --- a/app/views/layouts/_base_research_team.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - - <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - - <% end %> - <% unless @project.enabled_modules.where("name = 'boards'").empty? %> - - <% end%> - <% unless @project.enabled_modules.where("name = 'files'").empty? %> - - <% end%> \ No newline at end of file diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 83352de9d..35d8f87ef 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -20,5 +20,4 @@ !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> <%= exit_project_link(@project) %> <% end %> - diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 71975c5c3..beade0a7a 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -1,247 +1,245 @@ <% @nav_dispaly_project_label = 1 -@nav_dispaly_forum_label = 1 %> + @nav_dispaly_forum_label = 1 %> <%#@nav_dispaly_project_label = 1 %> - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> - <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> - <%= call_hook :view_layouts_base_html_head %> - - <%= yield :header_tags -%> + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> + <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> - - - - - -
    - <%= render :partial => 'layouts/new_header'%> + else if($("#friend_organization").attr("checked") == "checked"){ + project_type = 3; + } + $.get( + url, + { project_type: project_type}, + function (data) { + if(data == 1) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>'); + $("#close_light").attr("onClick","close_window('development_group');"); + } + else if(data == 2) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>'); + $("#close_light").attr("onClick","close_window('research_group');"); + } + else if(data == 3) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>'); + $("#close_light").attr("onClick","close_window('friend_organization');"); + } + else + { + alert("服务器异常,请与管理员联系"); + } + } + ); + } + + + + +
    + <%= render :partial => 'layouts/new_header'%> +
    + + +
    +
    +

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

    + +
    + +
    +
    +
    +
    + +
    + <%= l(:label_project_id)%><%= @project.id %> +
    + +
    + <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> + <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> + <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> +
    + +
    +
    + <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> + <% if @project.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> +
    +
    + <% if @project.project_type == 0 %> + <%= l(:label_project_score)%> : + <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "c_orange f14" ) %> + <% end %> +
    - -
    -
    -

    - - <%= l(:label_projects_community) %> - -

    - -
    - - <%= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %> - <%= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %> - - <%= l(:label_search)%> - -
    - + + -
    -
    -
    -
    - -
    - <%= l(:label_project_id)%><%= @project.id %> -
    - -
    - <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> - <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> - <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> -
    - -
    -
    - <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> - <% if @project.is_public? %> - <%= l(:label_public)%> - <% else %> - <%= l(:label_private)%> - <% end %> -
    -
    -
    - <% if @project.project_type == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id - }, :class => "c_orange f14" ) %> - <% end %> -
    - - -
    - <%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>) - - <%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>) - - <%= l(:project_module_attachments) %>( - <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - <%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %>) -
    -
    -
    - - - -
    - - -
    -
    -

    <%= l(:label_project_overview)%>:

    -
    - <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> -
    -
    -
    - - - - -
    -
    + + <% end %> + + +
    + <% if @project.project_new_type == 1 || @project.project_new_type.nil? %> + <%= render :partial => 'projects/development_group', :locals => {:project => @project}%> + <% elsif @project.project_new_type == 2 %> + <%= render :partial => 'projects/research_team', :locals => {:project => @project}%> + <% else %> + <%= render :partial => 'projects/friend_group', :locals => {:project => @project}%> + <% end %> +
    + +
    +
    - -
    -

    <%= l(:label_tag)%>:

    -
    -
    - <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> -
    -
    -
    -
    -
    -
    + +
    +
    +

    <%= l(:label_project_overview)%>:

    +
    + <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> +
    +
    +
    + + + + +
    +
    -
    - <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
    -
    -
    -
    - <%= render :partial => 'layouts/new_footer'%> + +
    +

    <%= l(:label_tag)%>:

    +
    +
    + <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> +
    +
    -
    -
    - - <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> -
    -
    -

    请选择项目类型:

    -
      -
    • id="development_group"/>
    • -
    • id="research_group"/>
    • -
    • id="friend_organization"/>
    • -
    - 确定 - -
    +
    -
    123
    - <%= render :partial => 'layouts/new_feedback' %> - - - <%= call_hook :view_layouts_base_body_bottom %> - +
    + +
    + <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
    +
    +
    +
    + <%= render :partial => 'layouts/new_footer'%> +
    +
    +
    + + <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> +
    +
    +

    请选择项目类型:

    +
      +
    • id="development_group"/>
    • +
    • id="research_group"/>
    • +
    • id="friend_organization"/>
    • +
    + 确定 + +
    +
    +
    123
    +<%= render :partial => 'layouts/new_feedback' %> + + +<%= call_hook :view_layouts_base_body_bottom %> + diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb new file mode 100644 index 000000000..7f79fc5f1 --- /dev/null +++ b/app/views/projects/_development_group.html.erb @@ -0,0 +1,52 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> +<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> +<% if visible_repository?(@project) %> + +<% end %> + + + \ No newline at end of file diff --git a/app/views/projects/_friend_group.html.erb b/app/views/projects/_friend_group.html.erb new file mode 100644 index 000000000..dca5473f7 --- /dev/null +++ b/app/views/projects/_friend_group.html.erb @@ -0,0 +1,29 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> \ No newline at end of file diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb new file mode 100644 index 000000000..2a0ad1ef3 --- /dev/null +++ b/app/views/projects/_research_team.html.erb @@ -0,0 +1,40 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end%> \ No newline at end of file From 6c6ae38f7a18b149746dfc0ed05dc99267edc7ca Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 19 May 2015 10:19:49 +0800 Subject: [PATCH 012/134] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index edde12527..85ef3240a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1904,6 +1904,18 @@ input.autocomplete.ajax-loading { background-image: url(../images/loading.gif); } +.private_project { + position: relative; + bottom: 2px; + text-transform: uppercase; + background: #d22; + color: #fff; + font-weight: bold; + padding: 0px 2px 0px 2px; + font-size: 60%; + margin-right: 2px; + border-radius: 2px; +} /***** Flash & error messages ****/ #errorExplanation, div.flash, .nodata, .warning, .conflict { padding: 4px 4px 4px 30px; From 5cb9cc0903b737ad2cee8a34573f18e746d0c368 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 19 May 2015 10:35:17 +0800 Subject: [PATCH 013/134] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2211:course?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5--=E8=BF=98=E6=9C=89=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=BE=E7=A8=8B=E8=80=81=E5=B8=88=E7=9A=84?= =?UTF-8?q?=E5=A7=93=E5=90=8D=E5=B0=B1=E4=B8=8D=E8=A6=81=E4=BB=A5=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_course_list.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index 0d979c769..111c0abb1 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -5,13 +5,13 @@
    - +
    <% unless course.is_public == 1 %> <%= l(:label_private) %> <% end %> - <%= link_to(course.name.truncate(25, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.name+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - +
    <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> <%#=course.try(:teacher).try(:name)%> From 895058f38ecb81c2a0eca44b12fba663516264a0 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 19 May 2015 11:30:31 +0800 Subject: [PATCH 014/134] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2154:=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=B8=8A=E4=BC=A0=E8=AF=BE=E4=BB=B6=EF=BC=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=B5=84=E6=BA=90=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=9C=AA?= =?UTF-8?q?=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/files/create.js.erb | 2 ++ app/views/layouts/base_courses.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index b00ae3612..87bf5b864 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -27,6 +27,8 @@ $('#upload_file_div').slideToggle('slow'); <%elsif @course%> closeModal(); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); + $("#courses_files_count_info").html("<%= @all_attachments.count%>"); + $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") <% end %> <% end %> $(document).ready(img_thumbnails); diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6820ccaf3..070a99d08 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -95,7 +95,7 @@ <%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>) - <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue' %>)
    + <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)
    @@ -127,7 +127,7 @@
    <%= call_hook(:view_issues_new_top, {:issue => @issue}) %> - <%= labelled_form_for @issue, :url => project_issues_path(@project), :html => {:id => 'issue-form', :multipart => true} do |f| %> <%= error_messages_for 'issue' %> @@ -16,7 +15,6 @@ <%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %> <% end %> -
    <% content_for :header_tags do %> diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 7f79fc5f1..676761831 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -8,8 +8,8 @@ <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
    -

    + <% if replying%> +

    + <% else %> +

    + <%end %>
  • diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 05304e978..d7c8972fc 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -1,4 +1,4 @@ -<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:nhname=>'form', :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index ae8dd5ed2..dc1cff634 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -31,72 +31,73 @@

    讨论区共有<%= @topic_count %>个帖子

    <% if @topics.any? %> <% @topics.each do |topic| %> -
    -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
    - <% author = topic.author.to_s + ":" %> - <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> -

      <%= h(topic.subject) %>

    - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - <%= link_to( - l(:button_delete), - {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr', - :style => ' margin-right: 10px;' - ) if topic.destroyable_by?(User.current) %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> -
    -
    -
    - <%= topic.content.html_safe %> -
    -
    - - <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
    - <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> - <% end %> -
    -
    - -
    -
    - -
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - -
    - - <% end %> -
    - +
    + <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> +
    + <% author = topic.author.to_s + ":" %> + <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> +

      <%= h(topic.subject) %>

    +
    + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= link_to( + l(:button_delete), + {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'talk_edit fr', + :style => ' margin-right: 10px;' + ) if topic.destroyable_by?(User.current) %> + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> +
    +
    +
    +
    + <%= topic.content.html_safe %> +
    +
    + + <%= link_to_attachments_course topic, :author => false %> + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> +
    + <% if User.current.logged? %> + <%= l(:button_reply) %> + <% end %> +
    + +
    +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + + <% end %> +
    +
    +
    <% end %> <% end %> @@ -130,7 +131,8 @@ function nh_init_board(params){ params.showbtn.click(function(){//发帖/编辑/回复按钮的click if(params.textarea.data('init') == undefined){ - var editor = params.kindutil.create(params.textarea, {//初始化编辑器 + //初始化编辑器 + var editor = params.kindutil.create(params.textarea, { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, @@ -138,7 +140,8 @@ width:"565px", items : [] }); - params.submitbtn.click(function(){//提交按钮click + //表单提交 + params.form.submit(function(){ var is_checked = nh_check_field({ subject:params.inputsubject, subjectmsg:params.subjectmsg, @@ -148,14 +151,29 @@ if(is_checked){ alert('submit'); params.textarea.html(editor.html()); -// params.form.submit(); + return false; +// return true; } + return false; }); - params.cancelbtn.click(function(){//取消按钮click + //提交按钮click + params.submitbtn.click(function(){ + params.form.submit(); + }); + //取消按钮click + params.cancelbtn.click(function(){ params.about_talk.toggle();//显示/隐藏编辑区 - params.inputsubject.focus(); + if(params.about_talk.is(':hidden')){//隐藏时reset表单数据 + params.form[0].reset(); + editor.html(params.textarea.html()); + params.subjectmsg.hide(); + params.contentmsg.hide(); + }else{ + if(params.type=='reply'){editor.focus();}//有bug 页面不跟着跳 + else params.inputsubject.focus(); + } }); - params.textarea.data('init','1') + params.textarea.data('init','1');//标记为已经初始化 } params.cancelbtn.click();//显示/隐藏编辑区 }); @@ -178,10 +196,11 @@ form:$("form[nhname='form']",about_talk) }); }); - $("div[ecname='container_board_reply']").each(function(){ + $("div[mhname='container_board_reply']").each(function(){ var container = $(this); var about_talk = $("div[nhname='about_talk_reply']",container); nh_init_board({ + type:'reply', kindutil:K, showbtn:$("a[nhname='showbtn_reply']",container), about_talk:about_talk, From fc8b5c60c60a0e7543c3fc60ba1605de766947e4 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 25 May 2015 15:33:52 +0800 Subject: [PATCH 071/134] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 83f68d8d8..cadff5f15 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -126,10 +126,10 @@ class IssuesController < ApplicationController @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @priorities = IssuePriority.active @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) - + @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq - + respond_to do |format| format.html { retrieve_previous_and_next_issue_ids From a27b3e9dc667a3384f4b9f58537938d29cc31452 Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Mon, 25 May 2015 23:22:11 +0800 Subject: [PATCH 072/134] Signed-off-by: alanlong9278 <547533434@qq.com> --- db/schema.rb | 7 - test/test_helper.rb | 1042 +++++++++++++++++++++---------------------- 2 files changed, 521 insertions(+), 528 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index de6655544..f8d638a5f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -438,13 +438,6 @@ ActiveRecord::Schema.define(:version => 20150514133640) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false diff --git a/test/test_helper.rb b/test/test_helper.rb index b7d786704..4e75da59b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,521 +1,521 @@ -require 'rubygems' -# require 'spork' -#uncomment the following line to use spork with the debugger -#require 'spork/ext/ruby-debug' - -# Spork.prefork do -# # Loading more in this block will cause your tests to run faster. However, -# # if you change any configuration or code from libraries loaded here, you'll -# # need to restart spork for it take effect. -# ENV["RAILS_ENV"] = "test" -# require File.expand_path('../../config/environment', __FILE__) -# require 'rails/test_help' -# -# end -# -# Spork.each_run do -# # This code will be run each time you run your specs. -# -# end - -# --- Instructions --- -# Sort the contents of this file into a Spork.prefork and a Spork.each_run -# block. -# -# The Spork.prefork block is run only once when the spork server is started. -# You typically want to place most of your (slow) initializer code in here, in -# particular, require'ing any 3rd-party gems that you don't normally modify -# during development. -# -# The Spork.each_run block is run each time you run your specs. In case you -# need to load files that tend to change during development, require them here. -# With Rails, your application modules are loaded automatically, so sometimes -# this block can remain empty. -# -# Note: You can modify files loaded *from* the Spork.each_run block without -# restarting the spork server. However, this file itself will not be reloaded, -# so if you change any of the code inside the each_run block, you still need to -# restart the server. In general, if you have non-trivial code in this file, -# it's advisable to move it into a separate file so you can easily edit it -# without restarting spork. (For example, with RSpec, you could move -# non-trivial code into a file spec/support/my_helper.rb, making sure that the -# spec/support/* files are require'd from inside the each_run block.) -# -# Any code that is left outside the two blocks will be run during preforking -# *and* during each_run -- that's probably not what you want. -# -# These instructions should self-destruct in 10 seconds. If they don't, feel -# free to delete them. - - - - -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#require 'shoulda' -ENV["RAILS_ENV"] = "test" -require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -require 'rails/test_help' -require Rails.root.join('test', 'mocks', 'open_id_authentication_mock.rb').to_s - -require File.expand_path(File.dirname(__FILE__) + '/object_helpers') -include ObjectHelpers - -class ActiveSupport::TestCase - include ActionDispatch::TestProcess - - self.use_transactional_fixtures = true - self.use_instantiated_fixtures = false - - def log_user(login, password) - User.anonymous - get "/login" - assert_equal nil, session[:user_id] - puts response.response_code() - assert_response :success - assert_template "account/login" - post "/login", :username => login, :password => password - assert_equal login, User.find(session[:user_id]).login - end - - def uploaded_test_file(name, mime) - fixture_file_upload("files/#{name}", mime, true) - end - - def credentials(user, password=nil) - {'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)} - end - - # Mock out a file - def self.mock_file - file = 'a_file.png' - file.stubs(:size).returns(32) - file.stubs(:original_filename).returns('a_file.png') - file.stubs(:content_type).returns('image/png') - file.stubs(:read).returns(false) - file - end - - def mock_file - self.class.mock_file - end - - def mock_file_with_options(options={}) - file = '' - file.stubs(:size).returns(32) - original_filename = options[:original_filename] || nil - file.stubs(:original_filename).returns(original_filename) - content_type = options[:content_type] || nil - file.stubs(:content_type).returns(content_type) - file.stubs(:read).returns(false) - file - end - - # Use a temporary directory for attachment related tests - def set_tmp_attachments_directory - Dir.mkdir "#{Rails.root}/tmp/test" unless File.directory?("#{Rails.root}/tmp/test") - unless File.directory?("#{Rails.root}/tmp/test/attachments") - Dir.mkdir "#{Rails.root}/tmp/test/attachments" - end - Attachment.storage_path = "#{Rails.root}/tmp/test/attachments" - end - - def set_fixtures_attachments_directory - Attachment.storage_path = "#{Rails.root}/test/fixtures/files" - end - - def with_settings(options, &block) - saved_settings = options.keys.inject({}) do |h, k| - h[k] = case Setting[k] - when Symbol, false, true, nil - Setting[k] - else - Setting[k].dup - end - h - end - options.each {|k, v| Setting[k] = v} - yield - ensure - saved_settings.each {|k, v| Setting[k] = v} if saved_settings - end - - # Yields the block with user as the current user - def with_current_user(user, &block) - saved_user = User.current - User.current = user - yield - ensure - User.current = saved_user - end - - def change_user_password(login, new_password) - user = User.first(:conditions => {:login => login}) - user.password, user.password_confirmation = new_password, new_password - user.save! - end - - def self.ldap_configured? - @test_ldap = Net::LDAP.new(:host => '127.0.0.1', :port => 389) - return @test_ldap.bind - rescue Exception => e - # LDAP is not listening - return nil - end - - def self.convert_installed? - Redmine::Thumbnail.convert_available? - end - - # Returns the path to the test +vendor+ repository - def self.repository_path(vendor) - Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s - end - - # Returns the url of the subversion test repository - def self.subversion_repository_url - path = repository_path('subversion') - path = '/' + path unless path.starts_with?('/') - "file://#{path}" - end - - # Returns true if the +vendor+ test repository is configured - def self.repository_configured?(vendor) - File.directory?(repository_path(vendor)) - end - - def repository_path_hash(arr) - hs = {} - hs[:path] = arr.join("/") - hs[:param] = arr.join("/") - hs - end - - def assert_save(object) - saved = object.save - message = "#{object.class} could not be saved" - errors = object.errors.full_messages.map {|m| "- #{m}"} - message << ":\n#{errors.join("\n")}" if errors.any? - assert_equal true, saved, message - end - - def assert_error_tag(options={}) - assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options)) - end - - def assert_include(expected, s, message=nil) - assert s.include?(expected), (message || "\"#{expected}\" not found in \"#{s}\"") - end - - def assert_not_include(expected, s) - assert !s.include?(expected), "\"#{expected}\" found in \"#{s}\"" - end - - def assert_select_in(text, *args, &block) - d = HTML::Document.new(CGI::unescapeHTML(String.new(text))).root - assert_select(d, *args, &block) - end - - def assert_mail_body_match(expected, mail) - if expected.is_a?(String) - assert_include expected, mail_body(mail) - else - assert_match expected, mail_body(mail) - end - end - - def assert_mail_body_no_match(expected, mail) - if expected.is_a?(String) - assert_not_include expected, mail_body(mail) - else - assert_no_match expected, mail_body(mail) - end - end - - def mail_body(mail) - mail.parts.first.body.encoded - end -end - -module Redmine - module ApiTest - # Base class for API tests - class Base < ActionDispatch::IntegrationTest - # Test that a request allows the three types of API authentication - # - # * HTTP Basic with username and password - # * HTTP Basic with an api key for the username - # * Key based with the key=X parameter - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_api_authentication(http_method, url, parameters={}, options={}) - should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters, options) - should_allow_http_basic_auth_with_key(http_method, url, parameters, options) - should_allow_key_based_auth(http_method, url, parameters, options) - end - - # Test that a request allows the username and password for HTTP BASIC - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow http basic auth using a username and password for #{http_method} #{url}" do - context "with a valid HTTP authentication" do - setup do - @user = User.generate! do |user| - user.admin = true - user.password = 'my_password' - end - send(http_method, url, parameters, credentials(@user.login, 'my_password')) - end - - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid HTTP authentication" do - setup do - @user = User.generate! - send(http_method, url, parameters, credentials(@user.login, 'wrong_password')) - end - - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - - context "without credentials" do - setup do - send(http_method, url, parameters) - end - - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "include_www_authenticate_header" do - assert @controller.response.headers.has_key?('WWW-Authenticate') - end - end - end - end - - # Test that a request allows the API key with HTTP BASIC - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_http_basic_auth_with_key(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow http basic auth with a key for #{http_method} #{url}" do - context "with a valid HTTP authentication using the API token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - send(http_method, url, parameters, credentials(@token.value, 'X')) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid HTTP authentication" do - setup do - @user = User.generate! - @token = Token.create!(:user => @user, :action => 'feeds') - send(http_method, url, parameters, credentials(@token.value, 'X')) - end - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - end - end - - # Test that a request allows full key authentication - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url, without the key=ZXY parameter - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_key_based_auth(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow key based auth using key=X for #{http_method} #{url}" do - context "with a valid api token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - # Simple url parse to add on ?key= or &key= - request_url = if url.match(/\?/) - url + "&key=#{@token.value}" - else - url + "?key=#{@token.value}" - end - send(http_method, request_url, parameters) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid api token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'feeds') - # Simple url parse to add on ?key= or &key= - request_url = if url.match(/\?/) - url + "&key=#{@token.value}" - else - url + "?key=#{@token.value}" - end - send(http_method, request_url, parameters) - end - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - end - - context "should allow key based auth using X-Redmine-API-Key header for #{http_method} #{url}" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - send(http_method, url, parameters, {'X-Redmine-API-Key' => @token.value.to_s}) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - end - - # Uses should_respond_with_content_type based on what's in the url: - # - # '/project/issues.xml' => should_respond_with_content_type :xml - # '/project/issues.json' => should_respond_with_content_type :json - # - # @param [String] url Request - def self.should_respond_with_content_type_based_on_url(url) - case - when url.match(/xml/i) - should "respond with XML" do - assert_equal 'application/xml', @response.content_type - end - when url.match(/json/i) - should "respond with JSON" do - assert_equal 'application/json', @response.content_type - end - else - raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}" - end - end - - # Uses the url to assert which format the response should be in - # - # '/project/issues.xml' => should_be_a_valid_xml_string - # '/project/issues.json' => should_be_a_valid_json_string - # - # @param [String] url Request - def self.should_be_a_valid_response_string_based_on_url(url) - case - when url.match(/xml/i) - should_be_a_valid_xml_string - when url.match(/json/i) - should_be_a_valid_json_string - else - raise "Unknown content type for should_be_a_valid_response_based_on_url: #{url}" - end - end - - # Checks that the response is a valid JSON string - def self.should_be_a_valid_json_string - should "be a valid JSON string (or empty)" do - assert(response.body.blank? || ActiveSupport::JSON.decode(response.body)) - end - end - - # Checks that the response is a valid XML string - def self.should_be_a_valid_xml_string - should "be a valid XML string" do - assert REXML::Document.new(response.body) - end - end - - def self.should_respond_with(status) - should "respond with #{status}" do - assert_response status - end - end - end - end -end - -# URL helpers do not work with config.threadsafe! -# https://github.com/rspec/rspec-rails/issues/476#issuecomment-4705454 -ActionView::TestCase::TestController.instance_eval do - helper Rails.application.routes.url_helpers -end -ActionView::TestCase::TestController.class_eval do - def _routes - Rails.application.routes - end -end +require 'rubygems' +# require 'spork' +#uncomment the following line to use spork with the debugger +#require 'spork/ext/ruby-debug' + +# Spork.prefork do +# # Loading more in this block will cause your tests to run faster. However, +# # if you change any configuration or code from libraries loaded here, you'll +# # need to restart spork for it take effect. +# ENV["RAILS_ENV"] = "test" +# require File.expand_path('../../config/environment', __FILE__) +# require 'rails/test_help' +# +# end +# +# Spork.each_run do +# # This code will be run each time you run your specs. +# +# end + +# --- Instructions --- +# Sort the contents of this file into a Spork.prefork and a Spork.each_run +# block. +# +# The Spork.prefork block is run only once when the spork server is started. +# You typically want to place most of your (slow) initializer code in here, in +# particular, require'ing any 3rd-party gems that you don't normally modify +# during development. +# +# The Spork.each_run block is run each time you run your specs. In case you +# need to load files that tend to change during development, require them here. +# With Rails, your application modules are loaded automatically, so sometimes +# this block can remain empty. +# +# Note: You can modify files loaded *from* the Spork.each_run block without +# restarting the spork server. However, this file itself will not be reloaded, +# so if you change any of the code inside the each_run block, you still need to +# restart the server. In general, if you have non-trivial code in this file, +# it's advisable to move it into a separate file so you can easily edit it +# without restarting spork. (For example, with RSpec, you could move +# non-trivial code into a file spec/support/my_helper.rb, making sure that the +# spec/support/* files are require'd from inside the each_run block.) +# +# Any code that is left outside the two blocks will be run during preforking +# *and* during each_run -- that's probably not what you want. +# +# These instructions should self-destruct in 10 seconds. If they don't, feel +# free to delete them. + + + + +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +#require 'shoulda' +ENV["RAILS_ENV"] = "test" +require File.expand_path(File.dirname(__FILE__) + "/../config/environment") +require 'rails/test_help' +require Rails.root.join('test', 'mocks', 'open_id_authentication_mock.rb').to_s + +require File.expand_path(File.dirname(__FILE__) + '/object_helpers') +include ObjectHelpers + +class ActiveSupport::TestCase + include ActionDispatch::TestProcess + + self.use_transactional_fixtures = true + self.use_instantiated_fixtures = false + + def log_user(login, password) + User.anonymous + get "/login" + assert_equal nil, session[:user_id] + puts response.response_code() + assert_response :success + assert_template "account/login" + post "/login", :username => login, :password => password + assert_equal login, User.find(session[:user_id]).login + end + + def uploaded_test_file(name, mime) + fixture_file_upload("files/#{name}", mime, true) + end + + def credentials(user, password=nil) + {'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)} + end + + # Mock out a file + def self.mock_file + file = 'a_file.png' + file.stubs(:size).returns(32) + file.stubs(:original_filename).returns('a_file.png') + file.stubs(:content_type).returns('image/png') + file.stubs(:read).returns(false) + file + end + + def mock_file + self.class.mock_file + end + + def mock_file_with_options(options={}) + file = '' + file.stubs(:size).returns(32) + original_filename = options[:original_filename] || nil + file.stubs(:original_filename).returns(original_filename) + content_type = options[:content_type] || nil + file.stubs(:content_type).returns(content_type) + file.stubs(:read).returns(false) + file + end + + # Use a temporary directory for attachment related tests + def set_tmp_attachments_directory + Dir.mkdir "#{Rails.root}/tmp/test" unless File.directory?("#{Rails.root}/tmp/test") + unless File.directory?("#{Rails.root}/tmp/test/attachments") + Dir.mkdir "#{Rails.root}/tmp/test/attachments" + end + Attachment.storage_path = "#{Rails.root}/tmp/test/attachments" + end + + def set_fixtures_attachments_directory + Attachment.storage_path = "#{Rails.root}/test/fixtures/files" + end + + def with_settings(options, &block) + saved_settings = options.keys.inject({}) do |h, k| + h[k] = case Setting[k] + when Symbol, false, true, nil + Setting[k] + else + Setting[k].dup + end + h + end + options.each {|k, v| Setting[k] = v} + yield + ensure + saved_settings.each {|k, v| Setting[k] = v} if saved_settings + end + + # Yields the block with user as the current user + def with_current_user(user, &block) + saved_user = User.current + User.current = user + yield + ensure + User.current = saved_user + end + + def change_user_password(login, new_password) + user = User.first(:conditions => {:login => login}) + user.password, user.password_confirmation = new_password, new_password + user.save! + end + + def self.ldap_configured? + @test_ldap = Net::LDAP.new(:host => '127.0.0.1', :port => 389) + return @test_ldap.bind + rescue Exception => e + # LDAP is not listening + return nil + end + + def self.convert_installed? + Redmine::Thumbnail.convert_available? + end + + # Returns the path to the test +vendor+ repository + def self.repository_path(vendor) + Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s + end + + # Returns the url of the subversion test repository + def self.subversion_repository_url + path = repository_path('subversion') + path = '/' + path unless path.starts_with?('/') + "file://#{path}" + end + + # Returns true if the +vendor+ test repository is configured + def self.repository_configured?(vendor) + File.directory?(repository_path(vendor)) + end + + def repository_path_hash(arr) + hs = {} + hs[:path] = arr.join("/") + hs[:param] = arr.join("/") + hs + end + + def assert_save(object) + saved = object.save + message = "#{object.class} could not be saved" + errors = object.errors.full_messages.map {|m| "- #{m}"} + message << ":\n#{errors.join("\n")}" if errors.any? + assert_equal true, saved, message + end + + def assert_error_tag(options={}) + assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options)) + end + + def assert_include(expected, s, message=nil) + assert s.include?(expected), (message || "\"#{expected}\" not found in \"#{s}\"") + end + + def assert_not_include(expected, s) + assert !s.include?(expected), "\"#{expected}\" found in \"#{s}\"" + end + + def assert_select_in(text, *args, &block) + d = HTML::Document.new(CGI::unescapeHTML(String.new(text))).root + assert_select(d, *args, &block) + end + + def assert_mail_body_match(expected, mail) + if expected.is_a?(String) + assert_include expected, mail_body(mail) + else + assert_match expected, mail_body(mail) + end + end + + def assert_mail_body_no_match(expected, mail) + if expected.is_a?(String) + assert_not_include expected, mail_body(mail) + else + assert_no_match expected, mail_body(mail) + end + end + + def mail_body(mail) + mail.parts.first.body.encoded + end +end + +module Redmine + module ApiTest + # Base class for API tests + class Base < ActionDispatch::IntegrationTest + # Test that a request allows the three types of API authentication + # + # * HTTP Basic with username and password + # * HTTP Basic with an api key for the username + # * Key based with the key=X parameter + # + # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) + # @param [String] url the request url + # @param [optional, Hash] parameters additional request parameters + # @param [optional, Hash] options additional options + # @option options [Symbol] :success_code Successful response code (:success) + # @option options [Symbol] :failure_code Failure response code (:unauthorized) + def self.should_allow_api_authentication(http_method, url, parameters={}, options={}) + should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters, options) + should_allow_http_basic_auth_with_key(http_method, url, parameters, options) + should_allow_key_based_auth(http_method, url, parameters, options) + end + + # Test that a request allows the username and password for HTTP BASIC + # + # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) + # @param [String] url the request url + # @param [optional, Hash] parameters additional request parameters + # @param [optional, Hash] options additional options + # @option options [Symbol] :success_code Successful response code (:success) + # @option options [Symbol] :failure_code Failure response code (:unauthorized) + def self.should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters={}, options={}) + success_code = options[:success_code] || :success + failure_code = options[:failure_code] || :unauthorized + + context "should allow http basic auth using a username and password for #{http_method} #{url}" do + context "with a valid HTTP authentication" do + setup do + @user = User.generate! do |user| + user.admin = true + user.password = 'my_password' + end + send(http_method, url, parameters, credentials(@user.login, 'my_password')) + end + + should_respond_with success_code + should_respond_with_content_type_based_on_url(url) + should "login as the user" do + assert_equal @user, User.current + end + end + + context "with an invalid HTTP authentication" do + setup do + @user = User.generate! + send(http_method, url, parameters, credentials(@user.login, 'wrong_password')) + end + + should_respond_with failure_code + should_respond_with_content_type_based_on_url(url) + should "not login as the user" do + assert_equal User.anonymous, User.current + end + end + + context "without credentials" do + setup do + send(http_method, url, parameters) + end + + should_respond_with failure_code + should_respond_with_content_type_based_on_url(url) + should "include_www_authenticate_header" do + assert @controller.response.headers.has_key?('WWW-Authenticate') + end + end + end + end + + # Test that a request allows the API key with HTTP BASIC + # + # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) + # @param [String] url the request url + # @param [optional, Hash] parameters additional request parameters + # @param [optional, Hash] options additional options + # @option options [Symbol] :success_code Successful response code (:success) + # @option options [Symbol] :failure_code Failure response code (:unauthorized) + def self.should_allow_http_basic_auth_with_key(http_method, url, parameters={}, options={}) + success_code = options[:success_code] || :success + failure_code = options[:failure_code] || :unauthorized + + context "should allow http basic auth with a key for #{http_method} #{url}" do + context "with a valid HTTP authentication using the API token" do + setup do + @user = User.generate! do |user| + user.admin = true + end + @token = Token.create!(:user => @user, :action => 'api') + send(http_method, url, parameters, credentials(@token.value, 'X')) + end + should_respond_with success_code + should_respond_with_content_type_based_on_url(url) + should_be_a_valid_response_string_based_on_url(url) + should "login as the user" do + assert_equal @user, User.current + end + end + + context "with an invalid HTTP authentication" do + setup do + @user = User.generate! + @token = Token.create!(:user => @user, :action => 'feeds') + send(http_method, url, parameters, credentials(@token.value, 'X')) + end + should_respond_with failure_code + should_respond_with_content_type_based_on_url(url) + should "not login as the user" do + assert_equal User.anonymous, User.current + end + end + end + end + + # Test that a request allows full key authentication + # + # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) + # @param [String] url the request url, without the key=ZXY parameter + # @param [optional, Hash] parameters additional request parameters + # @param [optional, Hash] options additional options + # @option options [Symbol] :success_code Successful response code (:success) + # @option options [Symbol] :failure_code Failure response code (:unauthorized) + def self.should_allow_key_based_auth(http_method, url, parameters={}, options={}) + success_code = options[:success_code] || :success + failure_code = options[:failure_code] || :unauthorized + + context "should allow key based auth using key=X for #{http_method} #{url}" do + context "with a valid api token" do + setup do + @user = User.generate! do |user| + user.admin = true + end + @token = Token.create!(:user => @user, :action => 'api') + # Simple url parse to add on ?key= or &key= + request_url = if url.match(/\?/) + url + "&key=#{@token.value}" + else + url + "?key=#{@token.value}" + end + send(http_method, request_url, parameters) + end + should_respond_with success_code + should_respond_with_content_type_based_on_url(url) + should_be_a_valid_response_string_based_on_url(url) + should "login as the user" do + assert_equal @user, User.current + end + end + + context "with an invalid api token" do + setup do + @user = User.generate! do |user| + user.admin = true + end + @token = Token.create!(:user => @user, :action => 'feeds') + # Simple url parse to add on ?key= or &key= + request_url = if url.match(/\?/) + url + "&key=#{@token.value}" + else + url + "?key=#{@token.value}" + end + send(http_method, request_url, parameters) + end + should_respond_with failure_code + should_respond_with_content_type_based_on_url(url) + should "not login as the user" do + assert_equal User.anonymous, User.current + end + end + end + + context "should allow key based auth using X-Redmine-API-Key header for #{http_method} #{url}" do + setup do + @user = User.generate! do |user| + user.admin = true + end + @token = Token.create!(:user => @user, :action => 'api') + send(http_method, url, parameters, {'X-Redmine-API-Key' => @token.value.to_s}) + end + should_respond_with success_code + should_respond_with_content_type_based_on_url(url) + should_be_a_valid_response_string_based_on_url(url) + should "login as the user" do + assert_equal @user, User.current + end + end + end + + # Uses should_respond_with_content_type based on what's in the url: + # + # '/project/issues.xml' => should_respond_with_content_type :xml + # '/project/issues.json' => should_respond_with_content_type :json + # + # @param [String] url Request + def self.should_respond_with_content_type_based_on_url(url) + case + when url.match(/xml/i) + should "respond with XML" do + assert_equal 'application/xml', @response.content_type + end + when url.match(/json/i) + should "respond with JSON" do + assert_equal 'application/json', @response.content_type + end + else + raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}" + end + end + + # Uses the url to assert which format the response should be in + # + # '/project/issues.xml' => should_be_a_valid_xml_string + # '/project/issues.json' => should_be_a_valid_json_string + # + # @param [String] url Request + def self.should_be_a_valid_response_string_based_on_url(url) + case + when url.match(/xml/i) + should_be_a_valid_xml_string + when url.match(/json/i) + should_be_a_valid_json_string + else + raise "Unknown content type for should_be_a_valid_response_based_on_url: #{url}" + end + end + + # Checks that the response is a valid JSON string + def self.should_be_a_valid_json_string + should "be a valid JSON string (or empty)" do + assert(response.body.blank? || ActiveSupport::JSON.decode(response.body)) + end + end + + # Checks that the response is a valid XML string + def self.should_be_a_valid_xml_string + should "be a valid XML string" do + assert REXML::Document.new(response.body) + end + end + + def self.should_respond_with(status) + should "respond with #{status}" do + assert_response status + end + end + end + end +end + +# URL helpers do not work with config.threadsafe! +# https://github.com/rspec/rspec-rails/issues/476#issuecomment-4705454 +ActionView::TestCase::TestController.instance_eval do + helper Rails.application.routes.url_helpers +end +ActionView::TestCase::TestController.class_eval do + def _routes + Rails.application.routes + end +end From b1a60d31182fc72c19bfaf173de7b686695c9760 Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Tue, 26 May 2015 00:01:15 +0800 Subject: [PATCH 073/134] Signed-off-by: alanlong9278 <547533434@qq.com> --- .gitignore | 2 +- config/additional_environment.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 config/additional_environment.rb diff --git a/.gitignore b/.gitignore index ffa4a1bc7..5810401cb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ *.swp /config/database.yml /config/configuration.yml -/config/additional_environment.rb + /files/* /log/* /public/tmp/* diff --git a/config/additional_environment.rb b/config/additional_environment.rb new file mode 100644 index 000000000..5c73f6aab --- /dev/null +++ b/config/additional_environment.rb @@ -0,0 +1,3 @@ +if Rails.env.production? + config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes } +end \ No newline at end of file From f52058aaf38fa3feb61c244bcaa6a45ee3306fa4 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 May 2015 09:37:29 +0800 Subject: [PATCH 074/134] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=96=B0=E7=95=8C=E9=9D=A2=EF=BC=88=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 1 + app/views/layouts/base.html.erb | 4 ++-- app/views/layouts/base_welcome.html.erb | 23 ++++++++--------------- app/views/welcome/index.html.erb | 4 ++-- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 6e067fb83..787b1b050 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WelcomeController < ApplicationController + layout "base_welcome" include ApplicationHelper include WelcomeHelper helper :project_score diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 439c5f7b2..483cabac5 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -12,7 +12,7 @@ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "jquery.leanModal.min" %> -<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> +<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> @@ -31,7 +31,7 @@
    <%=render :partial => 'layouts/base_footer'%> - + diff --git a/app/views/layouts/base_welcome.html.erb b/app/views/layouts/base_welcome.html.erb index d04f492ef..6d3b900c6 100644 --- a/app/views/layouts/base_welcome.html.erb +++ b/app/views/layouts/base_welcome.html.erb @@ -5,10 +5,9 @@ <%=h html_title %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> - <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project', :media => 'all' %> + <%= javascript_include_tag "jquery.leanModal.min" %> - <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= csrf_meta_tag %> <%= favicon %> @@ -18,32 +17,26 @@ <%= yield :header_tags -%> - -
    -
    -
    - <%=render :partial => 'layouts/base_header'%> + +
    + <%= render :partial => 'layouts/new_header' %> +
    <%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %>
    - <%=render :partial => 'layouts/base_footer'%> + <%=render :partial => 'layouts/new_footer'%>
    - -
    -
    <%= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index dc8ef7f35..0cd9622a5 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -23,7 +23,7 @@ $(document).ready(function($) { $("#loggedas").find("a").attr("target", "_blank"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); - }); + });
    @@ -45,7 +45,7 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> <%= l(:label_welcome_trustie_project)%><%= l(:label_welcome_trustie_project_description)%> From 3318d11c6df9ed15f676c89752b70986152d217b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 26 May 2015 09:48:22 +0800 Subject: [PATCH 075/134] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 15 +++++++++++++-- app/services/users_service.rb | 6 +++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 508d95200..96b788dab 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -107,7 +107,7 @@ module Mobile present :status,0 end - desc "给用户留言或回复用户留言" + desc "回复用户留言" params do requires :token, type: String requires :user_id, type: Integer,desc: '被留言的用户id' @@ -116,12 +116,23 @@ module Mobile requires :parent_id,type:Integer,desc:'留言父id' requires :ref_message_id,type:Integer,desc:'引用消息id' end - post ':user_id/leave_message' do + post ':user_id/reply_message' do us = UsersService.new jours = us.reply_user_messages params,current_user present :status,0 end + desc "给用户留言" + params do + requires :token, type: String + requires :user_id, type: Integer,desc:'被留言的用户id' + requires :content, type: String,desc:'留言内容' + end + post ':user_id/leave_message' do + us = UsersService.new + us.leave_message params,current_user + present :data,0 + end end end end diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 1ae477d74..7d7976bb5 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -184,7 +184,11 @@ class UsersService user.add_jour(nil, nil,nil,options) end - + # 给用户留言 + def leave_message params,current_user + obj = User.find(params[:user_id]).add_jour(current_user, params[:content], 0) + obj + end #关注列表 From 4244c69b4670775aaafec09dbdebeb6679f11336 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 26 May 2015 14:18:42 +0800 Subject: [PATCH 076/134] ... --- app/views/boards/_form_project.html.erb | 6 +- app/views/boards/_project_show.html.erb | 178 ++++++++++++++++++++---- 2 files changed, 153 insertions(+), 31 deletions(-) diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 58bb5501c..ca23193b4 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -15,7 +15,7 @@ <% replying ||= false %> <% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> <% if replying %> -
  • +
  • <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %> @@ -47,11 +47,11 @@
  • -
    +
    <% unless replying %> <% end %> - <%= text_area :quote,:quote,:style => 'display:none' %> + <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
    <% if replying%> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index dc1cff634..b0fd4049f 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -79,7 +79,7 @@
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% reply = Message.new(:subject => "RE: #{topic.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %>
    @@ -97,39 +97,107 @@ <% end %>
    + <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.id asc").all %> + <% unless replies_all.empty? %> +
    +
      + <% replies_all_i = 0 %> + <% replies_all.each do |message| %> + <% replies_all_i=replies_all_i+1 %> +
    • + <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> +
      + <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> +
      +

      <%= textAreailizable message,:content,:attachments => message.attachments %>

      +
      + <%= format_time(message.created_on) %> + <%= link_to( + + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => ' c_dblue fr' + ) if message.course_destroyable_by?(User.current) %> + <%= link_to( + l(:button_reply), + 'javascript:;', + :nhname =>'showbtn_child_reply', + :class => ' c_dblue fr', + :style => 'margin-right: 10px;', + :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> +
      +
      +
    • + <% end %> +
    +
    + <%if topic.replies_count>2 %> + + <% end %> + <% end %> <% end %> + <% else %> +

    <%= l(:label_no_data) %>

    + <% end %> + + + +<%# other_formats_links do |f| %> + <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> + <% html_title @board.name %> + <% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <% end %> +
    @@ -59,7 +62,7 @@ <%= topic.content.html_safe %>
    -
    + \ No newline at end of file From 0b6f35055dd977931ef9a985f48dd80fde31e136 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 26 May 2015 17:44:39 +0800 Subject: [PATCH 082/134] Signed-off-by: alan <547533434@qq.com> --- app/views/layouts/_user_courses_list.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 4 + .../projects/_development_group.html.erb | 73 ++++++++++--------- app/views/projects/_research_team.html.erb | 3 +- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb index 250ab1d5f..29366eb0e 100644 --- a/app/views/layouts/_user_courses_list.html.erb +++ b/app/views/layouts/_user_courses_list.html.erb @@ -3,7 +3,7 @@ <%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %> +<% end %> \ No newline at end of file diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb index b2b0e3c33..21a6ab31c 100644 --- a/app/views/projects/_research_team.html.erb +++ b/app/views/projects/_research_team.html.erb @@ -1,3 +1,4 @@ +<% cache @project %> <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> -<% end%> \ No newline at end of file +<% end%> From f3a15ce313692cc438a7969136bec00829fa5c90 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 26 May 2015 23:09:10 +0800 Subject: [PATCH 083/134] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E5=88=86=E6=9E=90=20oneapm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 ++ config/oneapm.yml | 135 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 config/oneapm.yml diff --git a/Gemfile b/Gemfile index fbe74f8dd..a43efbaeb 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,10 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end +source 'http://rubygems.oneapm.com' do + gem 'oneapm_rpm' +end + gem "mysql2", "= 0.3.18" gem 'redis-rails' gem 'rubyzip' diff --git a/config/oneapm.yml b/config/oneapm.yml new file mode 100644 index 000000000..e5b2e7bed --- /dev/null +++ b/config/oneapm.yml @@ -0,0 +1,135 @@ +# +# OneApm RubyAgent Configuration +# + +# Here are the settings that are common to all environments +common: &default_settings + # ============================== LICENSE KEY =============================== + + # + # Get your license key from oneapm.com + # + license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ=' + + # Agent Enabled (Ruby/Rails Only) + # Valid values are true, false and auto. + # + # agent_enabled: auto + + # This app_name will be the application name in oneapm.com in your account. + # + # Caution: If you change this name, a new application will appear in the OneApm + # user interface with the new name, and data will stop reporting to the + # app with the old name. + # + app_name: trusite + + # When "true", the agent collects performance data about your + # application and reports this data to the OneApm service at + # oneapm.com. This global switch is normally overridden for each + # environment below. (formerly called 'enabled') + monitor_mode: true + + # Specify its log level here. + log_level: info + + # log_file_path: 'log' + # log_file_name: 'oneapm_agent.log' + + # The oneapm agent communicates with the service via https by default. + # ssl: true + + # ======================== Browser Monitoring ============================= + browser_monitoring: + # By default the agent automatically injects the monitoring JavaScript + # into web pages. Set this attribute to false to turn off this behavior. + auto_instrument: true + + # Proxy settings for connecting to the OneApm server. + # + # proxy_host: hostname + # proxy_port: 8080 + # proxy_user: + # proxy_pass: + + # Tells transaction tracer and error collector (when enabled) + # whether or not to capture HTTP params. When true, frameworks can + # exclude HTTP parameters from being captured. + # Rails: the RoR filter_parameter_logging excludes parameters + capture_params: false + + # Transaction tracer captures deep information about slow + # transactions and sends this to the OneApm service once a + # minute. Included in the transaction is the exact call sequence of + # the transactions including any SQL statements issued. + transaction_tracer: + + # Transaction tracer is enabled by default. + enabled: true + + # Threshold in seconds for when to collect a transaction + # trace. When the response time of a controller action exceeds + # this threshold, a transaction trace will be recorded and sent to + # OneApm. Valid values are any float value, or (default) "apdex_f", + # which will use the threshold for an dissatisfying Apdex + # controller action - four times the Apdex T value. + transaction_threshold: apdex_f + + # When transaction tracer is on, SQL statements can optionally be + # recorded. The recorder has three modes, "off" which sends no + # SQL, "raw" which sends the SQL statement in its original form, + # and "obfuscated", which strips out numeric and string literals. + record_sql: obfuscated + + # Threshold in seconds for when to collect stack trace for a SQL + # call. In other words, when SQL statements exceed this threshold, + # then capture and send to OneApm the current stack trace. This is + # helpful for pinpointing where long SQL calls originate from. + stack_trace_threshold: 0.500 + + # Determines whether the agent will capture query plans for slow + # SQL queries. Only supported in mysql and postgres. Should be + # set to false when using other adapters. + # explain_enabled: true + + # Threshold for query execution time below which query plans will + # not be captured. Relevant only when `explain_enabled` is true. + # explain_threshold: 0.5 + + # Error collector captures information about uncaught exceptions and + # sends them to OneApm for viewing + error_collector: + + # Error collector is enabled by default. + enabled: true + + # Ignore the following errors, add your own. + ignore_errors: "ActionController::RoutingError,Sinatra::NotFound" + +# ===================== Application Environments ======================== +# Environment-specific settings are in this section. +# For Rails applications, RAILS_ENV is used to determine the environment. + +# NOTE if your application has other named environments, you should +# provide oneapm configuration settings for these environments here. + +development: + <<: *default_settings + # Turn on communication to OneApm service in development mode + monitor_mode: true + app_name: My Application (Development) + +test: + <<: *default_settings + monitor_mode: false + +# Turn on the agent in production for 24x7 monitoring. +production: + <<: *default_settings + monitor_mode: true + +# Staging environment which behaves identically to production. +staging: + <<: *default_settings + monitor_mode: true + app_name: My Application (Staging) From 9ce1916fbb3f309e2045e2e15f02372fb7eb8f81 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 26 May 2015 23:10:08 +0800 Subject: [PATCH 084/134] =?UTF-8?q?autologin=20token=20cookies=20domain?= =?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/controllers/account_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 7976e1aa4..75be302cd 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -336,6 +336,7 @@ class AccountController < ApplicationController :expires => 1.month.from_now, :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), + :domain => '.trustie.net', :httponly => true } cookies[autologin_cookie_name] = cookie_options From 3fa5179026e83a57aa18c957d36e45ff13556026 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 26 May 2015 23:11:10 +0800 Subject: [PATCH 085/134] =?UTF-8?q?issue=E6=95=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8B=96=E6=85=A2=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 676761831..726e9646f 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -8,9 +8,10 @@ <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
    + <% if @issue.editable? %>
    <%= render :partial => 'edit' %>
    -

    <%= l(:button_submit) %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index f3c453019..ffeeaef82 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -51,7 +51,7 @@ <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.project_issues_index}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"}, :class => "problem_tit fl fb" %>
    -

    <%= textAreailizable act,:notes %>
    +

    <%= textilizable act,:notes %>
    <%= l :label_activity_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

    From 10e24bebd50c9e4e3bc63ca68f87266e65e7e8ce Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 27 May 2015 08:56:34 +0800 Subject: [PATCH 087/134] =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 26d8df16f..49170bf30 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -364,19 +364,20 @@ class CoursesService latest_course_dynamics = [] latest_news = course.news.order("created_on desc").first unless latest_news.nil? - latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => get_user_language(current_user))} + latest_course_dynamics << {:type => 1,:time => latest_news.created_on, + :message =>latest_news.author.realname<< l(:label_recently_updated_notification,:locale => get_user_language(current_user))<<":"<< latest_news.title } end latest_message = course.journals_for_messages.order("created_on desc").first unless latest_message.nil? - latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} + latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message =>latest_message.user.realname << l(:label_recently_updated_message,:locale => get_user_language(current_user))<<":"< 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => get_user_language(current_user))} + latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<":"< 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))} + latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname< get_user_language(current_user))<<":"< 4,:time => latest_homework_attach.updated_at,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))} + latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message =>latest_homework_attach.user.realname<< l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<(latest_homework_attach.name.nil? ? latest_homework_attach.description : latest_homework_attach.name)} end latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]} latest_course_dynamic = latest_course_dynamics.first From dc557f7826eb05b5c94d06e1691ccb6e438b06e9 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 27 May 2015 09:04:39 +0800 Subject: [PATCH 088/134] ... --- app/views/boards/_project_show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index fd685f168..738d9ac63 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -104,7 +104,7 @@ <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). reorder("#{Message.table_name}.id asc").all %> <% unless replies_all.empty? %> -
    +
      <% replies_all_i = 0 %> <% replies_all.each do |message| %> @@ -294,6 +294,7 @@ $(".talkmain_box").each(function(){ var target = $("li[nhname='reply_rec']",$(this)); var btn = $("a[nhname='reply_ex_btn']",$(this)); + var jumpobj = $("div[nhname='nh_reply_div']",$(this)); btn.click(function(){ if($(this).data('init')=='0'){ $(this).data('init',1); @@ -305,6 +306,8 @@ target.hide(); target.eq(0).show(); target.eq(1).show(); + $("#nhjump").attr('href','#'+jumpobj.attr('id')); + $("#nhjump")[0].click(); } }); }); From 1919292c583388ffef1fe3f43229471b8a629916 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 27 May 2015 09:23:48 +0800 Subject: [PATCH 089/134] =?UTF-8?q?=E8=BF=98=E6=98=AFissues=20count?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_research_team.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb index b2b0e3c33..8bd32a98e 100644 --- a/app/views/projects/_research_team.html.erb +++ b/app/views/projects/_research_team.html.erb @@ -8,8 +8,8 @@ <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> -<% end%> \ No newline at end of file +<% end%> From 5af284e8a47cac37226b35e2cb4fc8c1bf1762b6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 27 May 2015 10:43:03 +0800 Subject: [PATCH 090/134] =?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=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 2 +- app/views/layouts/base_projects.html.erb | 115 +++++++++--------- .../projects/_development_group.html.erb | 1 - app/views/projects/_friend_group.html.erb | 1 - app/views/projects/_research_team.html.erb | 1 - 5 files changed, 56 insertions(+), 64 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index cadff5f15..539d84e65 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -130,7 +130,7 @@ class IssuesController < ApplicationController @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq - respond_to do |format| + respond_to do |format|`` format.html { retrieve_previous_and_next_issue_ids render :template => 'issues/show', :layout => @project_base_tag#by young diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 43861d99a..87ceeaf9a 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -18,54 +18,7 @@ <%= yield :header_tags -%> - - @@ -83,13 +36,7 @@
    @@ -166,14 +114,14 @@ <% end %> - + <%#--project_new_type: 1为开发组;2为科研组;3为朋友圈子--%>
    <% if @project.project_new_type == 1 || @project.project_new_type.nil? %> - <%= render :partial => 'projects/development_group', :locals => {:project => @project}%> + <%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <% elsif @project.project_new_type == 2 %> - <%= render :partial => 'projects/research_team', :locals => {:project => @project}%> + <%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %> <% else %> - <%= render :partial => 'projects/friend_group', :locals => {:project => @project}%> + <%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <% end %>
    @@ -232,8 +180,55 @@
  • id="friend_organization"/>
  • 确定 - + +
    123
    <%= render :partial => 'layouts/new_feedback' %> diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 726e9646f..d4bc7012a 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -1,4 +1,3 @@ -<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
    From cd38e9aa7009f13a415ead66120039d82c7ac803 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 27 May 2015 15:50:31 +0800 Subject: [PATCH 095/134] ... --- app/views/boards/_course_show.html.erb | 63 ++++++------------------- app/views/boards/_project_show.html.erb | 2 +- app/views/boards/show.html.erb | 10 ++-- 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index fc3c38aad..ddf6a532d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -8,12 +8,14 @@ <% end %> - <%= l(:label_message_new) %> + <% if User.current.logged? %> + <%= l(:label_message_new) %> + <% end %>
    -
    + <% end %> - <% replies_all = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").offset(2). - all %> - <% replies_show = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").limit(2). - all %> - <% unless replies_show.empty? %> - <% reply_count = 0 %> -
    + <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").all %> + <% unless replies_all.empty? %> + <% replies_all_i = 0 %> +
      - <% replies_show.each do |message| %> - -
    • + <% replies_all.each do |message| %> + <% replies_all_i=replies_all_i+1 %> +
    • <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
      <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> @@ -157,37 +153,8 @@ <% end %>
    - - <%if replies_all.first %> - + <%if topic.replies_count>2 %> + <% end %> <% end %>
    diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index d6332a029..d20119a6c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -102,7 +102,7 @@
    <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.id asc").all %> + reorder("#{Message.table_name}.id desc").all %> <% unless replies_all.empty? %>
      diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 3d20fd411..bb3faf28f 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,5 +1,8 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> @@ -147,9 +148,9 @@ function nh_init_board(params){ textarea:params.textarea }); if(is_checked){ -// alert('submit'); -// return false; - return true; + //return true 居然不提交 fuck your sister + $(this)[0].submit(); +// return true; } return false; }); From 6f1573881712d5b7e6e399b2e1bfa620657ec7a4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 28 May 2015 12:23:56 +0800 Subject: [PATCH 105/134] =?UTF-8?q?=E6=8D=A2=E4=B8=80=E4=B8=AAautologin,?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=80=81=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 4 +++- app/controllers/application_controller.rb | 6 +++++- config/configuration.yml | 5 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index dc1cceb87..181f76b22 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -336,9 +336,11 @@ class AccountController < ApplicationController :expires => 1.month.from_now, :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), - :domain => Redmine::Configuration['cookie_domain'], :httponly => true } + if Redmine::Configuration['cookie_domain'].present? + cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain']) + end cookies[autologin_cookie_name] = cookie_options end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 88cd51d67..10e5e6f06 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -199,7 +199,11 @@ class ApplicationController < ActionController::Base # Logs out current user def logout_user if User.current.logged? - cookies.delete(autologin_cookie_name, domain: :all) + if Redmine::Configuration['cookie_domain'].present? + cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain']) + else + cookies.delete autologin_cookie_name + end # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) self.logged_user = nil end diff --git a/config/configuration.yml b/config/configuration.yml index 45e307157..390754a87 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -90,7 +90,6 @@ default: user_name: "huang.jingquan@163.com" password: 'xinhu1ji2qu366' - cookie_domain: ".trustie.net" # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. # Your Redmine instance needs to have write permission on this @@ -104,7 +103,7 @@ default: # autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_path: the cookie path (default: /) # autologin_cookie_secure: true sets the cookie secure flag (default: false) - autologin_cookie_name: + autologin_cookie_name: "autologin_trustie" autologin_cookie_path: autologin_cookie_secure: @@ -201,7 +200,7 @@ default: # specific configuration options for production environment # that overrides the default ones production: - # CJK support + cookie_domain: ".trustie.net" rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf email_delivery: delivery_method: :smtp From cae882b3d62b3ae5d0500c9563cca5c19dc58141 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 May 2015 14:44:04 +0800 Subject: [PATCH 106/134] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=A1=A8=20=E7=9B=B8=E5=85=B3=E5=85=B3?= =?UTF-8?q?=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/invite_list.rb | 5 +++++ app/models/project.rb | 2 +- app/models/user.rb | 4 ++++ db/migrate/20150528024616_create_invite_lists.rb | 10 ++++++++++ spec/factories/invite_lists.rb | 7 +++++++ spec/models/invite_list_spec.rb | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/models/invite_list.rb create mode 100644 db/migrate/20150528024616_create_invite_lists.rb create mode 100644 spec/factories/invite_lists.rb create mode 100644 spec/models/invite_list_spec.rb diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb new file mode 100644 index 000000000..605c35a07 --- /dev/null +++ b/app/models/invite_list.rb @@ -0,0 +1,5 @@ +class InviteList < ActiveRecord::Base + attr_accessible :project_id, :user_id + belongs_to :user + belongs_to :project +end diff --git a/app/models/project.rb b/app/models/project.rb index 47878dbec..249df8640 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -67,7 +67,7 @@ class Project < ActiveRecord::Base has_many :student, :through => :students_for_courses, :source => :user has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects - + has_many :invite_lists # end #ADDED BY NIE diff --git a/app/models/user.rb b/app/models/user.rb index 7b232bf13..fa3134a58 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -125,6 +125,10 @@ class User < Principal has_many :documents # 项目中关联的文档再次与人关联 # end + # 邮件邀请状态 + has_many :invite_lists + # end + ######added by nie has_many :project_infos, :dependent => :destroy has_one :user_status, :dependent => :destroy diff --git a/db/migrate/20150528024616_create_invite_lists.rb b/db/migrate/20150528024616_create_invite_lists.rb new file mode 100644 index 000000000..222a3a3f8 --- /dev/null +++ b/db/migrate/20150528024616_create_invite_lists.rb @@ -0,0 +1,10 @@ +class CreateInviteLists < ActiveRecord::Migration + def change + create_table :invite_lists do |t| + t.integer :project_id + t.integer :user_id + + t.timestamps + end + end +end diff --git a/spec/factories/invite_lists.rb b/spec/factories/invite_lists.rb new file mode 100644 index 000000000..c9ce0e826 --- /dev/null +++ b/spec/factories/invite_lists.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :invite_list do + project_id 1 +user_id 1 + end + +end diff --git a/spec/models/invite_list_spec.rb b/spec/models/invite_list_spec.rb new file mode 100644 index 000000000..8da327964 --- /dev/null +++ b/spec/models/invite_list_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe InviteList, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From f47d30f22ac137ab6c079d017d086b939328360d Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 28 May 2015 15:14:38 +0800 Subject: [PATCH 107/134] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E8=AE=BE=E7=BD=AE=20Signed-off-by:=20alan=20?= =?UTF-8?q?<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/welcome_controller.rb | 110 +++++++++--------- app/views/layouts/_base_header.html.erb | 2 + app/views/layouts/_user_courses_list.html.erb | 4 +- app/views/layouts/_user_project_list.html.erb | 2 + app/views/welcome/contest.html.erb | 6 +- app/views/welcome/index.html.erb | 12 +- db/schema.rb | 17 --- 8 files changed, 74 insertions(+), 81 deletions(-) diff --git a/Gemfile b/Gemfile index 9f2aa0ef6..c1f7bcbeb 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,7 @@ gem 'acts-as-taggable-on', '2.4.1' gem 'spreadsheet' gem 'ruby-ole' gem 'rails_kindeditor',path:'lib/rails_kindeditor' -gem "rmagick", ">= 2.0.0" +#gem "rmagick", ">= 2.0.0" group :development do gem 'grape-swagger' diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 3da0be4d8..432eec27b 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -19,71 +19,73 @@ class WelcomeController < ApplicationController include ApplicationHelper include WelcomeHelper helper :project_score - caches_action :robots, :course, :contest, :index, expires_in: 2.hours, layout: false + caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false #before_filter :find_first_page, :only => [:index] # before_filter :fake, :only => [:index, :course] before_filter :entry_select, :only => [:index] def index # 企业版定制: params[:project]为传过来的参数 - unless params[:organization].nil? - @organization = Organization.find params[:organization] - # @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all - @organization_projects = @organization.projects.visible.joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").order("project_scores.score DESC").limit(10).all - @part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : [] - # @cur_projects = Project.find(params[:organization]) - # @organization = @cur_projects.enterprise_name - # @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) - # @e_count = @organization_projects.count - # @part_projects = [] - # # 取十个 - # @organization_projects.each do |obj| - # break if(@organization_projects[10] == obj) - # @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? - # end - # # 不够十个的用最火项目替代 - # @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects - # # 配置文件首页定制 - @enterprise_page = FirstPage.find_by_page_type('enterprise') - if @enterprise_page.nil? - @enterprise_page = FirstPage.new - @enterprise_page.page_type = 'enterprise' + + unless params[:organization].nil? + @organization = Organization.find params[:organization] + # @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all + @organization_projects = @organization.projects.visible.joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").order("project_scores.score DESC").limit(10).all + @part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : [] + # @cur_projects = Project.find(params[:organization]) + # @organization = @cur_projects.enterprise_name + # @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) + # @e_count = @organization_projects.count + # @part_projects = [] + # # 取十个 + # @organization_projects.each do |obj| + # break if(@organization_projects[10] == obj) + # @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? + # end + # # 不够十个的用最火项目替代 + # @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects + # # 配置文件首页定制 + @enterprise_page = FirstPage.find_by_page_type('enterprise') + if @enterprise_page.nil? + @enterprise_page = FirstPage.new + @enterprise_page.page_type = 'enterprise' + end + # 主页配置部分结束 end - # 主页配置部分结束 - end - # end 企业版定制结束 + # end 企业版定制结束 - if @first_page.nil? || @first_page.sort_type.nil? - @projects = find_miracle_project(10, 3,"score desc") - else - case @first_page.sort_type - when 0 - @my_projects = find_my_projects - @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] - @projects = find_miracle_project(10, 3,"created_on desc") - #@projects = @projects_all.order("created_on desc") - when 1 - @my_projects = find_my_projects - @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] - @projects = find_miracle_project(10, 3,"score desc") - #@projects = @projects_all.order("grade desc") - when 2 - @my_projects = find_my_projects - @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] - @projects = find_miracle_project(10, 3,"watchers_count desc") - #@projects = @projects_all.order("watchers_count desc") + if @first_page.nil? || @first_page.sort_type.nil? + @projects = find_miracle_project(10, 3,"score desc") + else + case @first_page.sort_type + when 0 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] + @projects = find_miracle_project(10, 3,"created_on desc") + #@projects = @projects_all.order("created_on desc") + when 1 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] + @projects = find_miracle_project(10, 3,"score desc") + #@projects = @projects_all.order("grade desc") + when 2 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] + @projects = find_miracle_project(10, 3,"watchers_count desc") + #@projects = @projects_all.order("watchers_count desc") - #gcm - #when '3' - #@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array) - # @projects=handle_project @projects_all,@project_activity_count - # @s_type = 3 - # @projects = @projects[@project_pages.offset, @project_pages.per_page] + #gcm + #when '3' + #@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array) + # @projects=handle_project @projects_all,@project_activity_count + # @s_type = 3 + # @projects = @projects[@project_pages.offset, @project_pages.per_page] - else - @projects = @projects_all.order("score desc") + else + @projects = @projects_all.order("score desc") + end end - end + rescue Exception => e render_404 end diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 7a25819ab..fa8787122 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -1,11 +1,13 @@ <%= render :partial => "layouts/base_feedback" %>
      +
      <%= render_menu :account_menu -%>
      + <% if User.current.logged? -%>
        diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb index 29366eb0e..38ccf72bf 100644 --- a/app/views/layouts/_user_courses_list.html.erb +++ b/app/views/layouts/_user_courses_list.html.erb @@ -3,12 +3,14 @@ <%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %>
          <% course_index = 0 %> - <% cache User.current.courses.each do |course| %> + <% cache User.current.courses.count do%> + <% User.current.courses.each do |course| %> <% if !course_endTime_timeout?(course) %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <% course_index += 1 %> <% end %> <% end %> + <% end %>
        <% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index b05a065c8..f7cf841f8 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,11 +2,13 @@
      • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
          + <% cache User.current.projects.count do%> <% User.current.projects.each do |project| %>
        • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
        • <% end %> + <% end %>
      • <% end %> \ No newline at end of file diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 201afe574..582938146 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -141,15 +141,15 @@ <%= @contest_page.title %> !--> <%= l(:label_welcome_trustie_contest) %> - - , + + , - <%= l(:label_welcome_trustie_contest_description) %> + <%= l(:label_welcome_trustie_contest_description) %> <% end %>
      diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index dc8ef7f35..869df52a6 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -23,7 +23,7 @@ $(document).ready(function($) { $("#loggedas").find("a").attr("target", "_blank"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); - }); + });
      @@ -45,7 +45,7 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> <%= l(:label_welcome_trustie_project)%><%= l(:label_welcome_trustie_project_description)%> @@ -68,7 +68,7 @@
      - +<% cache :expire_in => 2.hours do%>

      <%= l(:lable_hot_projects)%>

      <% if User.current.logged? %> @@ -113,7 +113,7 @@
    - +<% end %>
    diff --git a/db/schema.rb b/db/schema.rb index bec7d0294..f8d638a5f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -438,13 +438,6 @@ ActiveRecord::Schema.define(:version => 20150514133640) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -659,16 +652,6 @@ ActiveRecord::Schema.define(:version => 20150514133640) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From e2ec7d5f3e40ad98d79c30a08f65257bd9d7ef44 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 May 2015 15:45:36 +0800 Subject: [PATCH 108/134] =?UTF-8?q?QQ=E5=9C=A8=E7=BA=BF=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_feedback.html.erb | 6 ++++-- app/views/layouts/_new_feedback.html.erb | 7 +++---- config/locales/commons/zh.yml | 2 +- public/stylesheets/public.css | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index d9bd5e376..07f852914 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -14,7 +14,7 @@ .close_btn span { display:none;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} .msgserver { margin:2px 0px 0px 4px; padding-top: 0px} - .msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;} + .msgserver a { padding-left:4px;} .opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;} .opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} .opnionButton:hover{background: #0fa9bb; } @@ -180,7 +180,9 @@ function cookieget(n) <% end %>
    diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index 67b4af32c..3b8098ed5 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -22,10 +22,9 @@ <% end %>
    diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 9ba8cba7a..a023bc8cb 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -353,7 +353,7 @@ zh: # label_feedback: 意见反馈 label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!" - label_technical_support: "技术支持:" + label_technical_support: "QQ 在线支持:" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" label_feedback_value: "该帖来自用户反馈:)" diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 6961b23c8..c8d18609f 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -287,7 +287,8 @@ html{ overflow-x:hidden;} .close_btn span { display:none;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} .msgserver { margin-top:5px;} -.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; } +/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/ +.msgserver a { padding-left:4px; height:21px; display:block; } .opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} a:hover.opnionButton{background: #0fa9bb; } From 709c026910a8274026b3b0ac007a8d20fd05cd5b Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 28 May 2015 15:48:52 +0800 Subject: [PATCH 109/134] ... --- app/views/boards/_course_show.html.erb | 4 ++-- app/views/boards/_project_show.html.erb | 2 +- app/views/boards/show.html.erb | 13 ++++++++----- public/images/public_icon.png | Bin 4987 -> 11734 bytes 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 889e82350..0b0e95b21 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -132,8 +132,8 @@
    <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
    -

    <%= textAreailizable message,:content,:attachments => message.attachments %>

    - +
    <%= textAreailizable message,:content,:attachments => message.attachments %>
    +
    <%= format_time(message.created_on) %> <%= link_to( diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 48b3d6ccf..a8dc4ad1a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -120,7 +120,7 @@
    <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
    -

    <%= textAreailizable message,:content,:attachments => message.attachments %>

    +
    <%= textAreailizable message,:content,:attachments => message.attachments %>

    <%= format_time(message.created_on) %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 8bc4cc7af..69300ec4b 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,7 +1,10 @@
    diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 5333b91a7..d27895b03 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -19,7 +19,7 @@ a:hover.project_name{ color:#016f33;} a.project_txt02{ color:#0781b4; width:618px; display:block; float:left; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a:hover.project_txt{ color:#066e9a;} .noline{ border-bottom:none;} -.news_description{max-height: 38px;overflow:hidden; } +.news_description{max-height: 360px;overflow:hidden; } .news_description_none{max-height: none;} a.news_foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:600px; height:20px; padding-top:3px; cursor:pointer;} a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} From 0eace6e598f57a3b10aae17bf7889b9f088347e4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 May 2015 18:42:22 +0800 Subject: [PATCH 126/134] =?UTF-8?q?cached=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=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/layouts/_user_project_list.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index f7cf841f8..e38f9c4bd 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,13 +2,11 @@
  • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
      - <% cache User.current.projects.count do%> <% User.current.projects.each do |project| %>
    • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
    • <% end %> - <% end %>
  • -<% end %> \ No newline at end of file +<% end %> From f4c1cc839c65fe8f7b3943e887e69bf2e166b28b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 May 2015 19:33:33 +0800 Subject: [PATCH 127/134] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stores/index.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 89405b8ab..6fab364b5 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -3,10 +3,10 @@ <% end %>
    -<% @attach_array.each do |k|%> +<% @attach_array.each_with_index do |k, index|%>

    - <%= @str_arr.shift %> + <%= @str_arr[index] %>

    @@ -24,7 +24,7 @@
    - <% if @str_arr.shift == @str_arr[2]%> + <% if index == 2%> <% k.each do |c1|%>
    @@ -94,4 +94,4 @@ } }); -<% html_title(l(:label_stores_index)) -%> \ No newline at end of file +<% html_title(l(:label_stores_index)) -%> From ee35de54474321e62308bf6738b8605865462cbf Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 May 2015 20:05:49 +0800 Subject: [PATCH 128/134] =?UTF-8?q?=E5=BF=BD=E7=95=A5redis=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5810401cb..fdb7a3c6b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.swp /config/database.yml /config/configuration.yml +/config/additional_environment.rb /files/* /log/* From 3967b632b55d4f82fa273934388073fea92c8b18 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 1 Jun 2015 10:41:23 +0800 Subject: [PATCH 129/134] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98=20Signed-off-by:=20alan=20<54753343?= =?UTF-8?q?4@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_courses_list.html.erb | 4 ++-- app/views/layouts/_user_project_list.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb index 38ccf72bf..ce9282ee7 100644 --- a/app/views/layouts/_user_courses_list.html.erb +++ b/app/views/layouts/_user_courses_list.html.erb @@ -3,14 +3,14 @@ <%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %>
      <% course_index = 0 %> - <% cache User.current.courses.count do%> + <% User.current.courses.each do |course| %> <% if !course_endTime_timeout?(course) %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <% course_index += 1 %> <% end %> <% end %> - <% end %> +
    <% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index f7cf841f8..c70086499 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,13 +2,13 @@
  • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
      - <% cache User.current.projects.count do%> + <% User.current.projects.each do |project| %>
    • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
    • <% end %> - <% end %> +
  • <% end %> \ No newline at end of file From 5347d83f8fe2294ede387aea4d69a04fedfe7768 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 1 Jun 2015 12:39:58 +0800 Subject: [PATCH 130/134] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 40275a29b..aff0a975c 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -245,10 +245,10 @@ class UsersService "show_changesets" => true } scope = User.logged.status(status) + search_by = params[:search_by] ? params[:search_by] : "0" if params[:is_search_assitant].nil? #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start #say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-! - search_by = params[:search_by] ? params[:search_by] : "0" if params[:name].present? if !params[:user_id].nil? watcher = User.watched_by(params[:user_id]) From 7bbd85f8c2046e1c5536b390f3a4e7a810e4c8ab Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 1 Jun 2015 13:50:06 +0800 Subject: [PATCH 131/134] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E8=B4=B4=E5=90=A7=E5=9B=9E=E5=A4=8D=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/course.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 476471897..256a976c4 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -195,7 +195,6 @@ <%= link_to "更多>>", forums_path %> <% topics = find_new_forum_topics(10) %> - <%# cache topics.maximum(:created_at) do%>
      @@ -233,8 +232,7 @@
    - <%# end %>
    -<%= render partial: 'link_to_another' %> \ No newline at end of file +<%= render partial: 'link_to_another' %> From e7868730615c0b20a1e80aea4e8190ad1f2db1bc Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 1 Jun 2015 13:58:37 +0800 Subject: [PATCH 132/134] =?UTF-8?q?=E8=BF=98=E6=98=AF=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 869df52a6..3acee0acf 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -123,7 +123,6 @@
    <% topics = find_new_forum_topics(12) %> - <% cache topics.maximum(:created_at) do%> <% topics.includes(:forum, :last_reply, :author).each do |topic|%>
  • @@ -153,10 +152,9 @@
  • <% end %> - <% end %>
    -<%= render partial: 'link_to_another' %> \ No newline at end of file +<%= render partial: 'link_to_another' %> From b6d22cfb314baf1c0605bc168370f91116acee63 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 1 Jun 2015 23:02:55 +0800 Subject: [PATCH 133/134] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 9 ++++++--- app/controllers/test_controller.rb | 6 ++++++ config/routes.rb | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d880ebe35..b2364165b 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -69,9 +69,12 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), - :disposition => 'attachment' #inline can open in browser + req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(@attachment.diskfile, 'rb') + render :text => req.body + + # send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), + # :type => detect_content_type(@attachment), + # :disposition => 'attachment' #inline can open in browser end else diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index 51ff293f1..12fead4f2 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -1,3 +1,5 @@ +require 'net/http' + class TestController < ApplicationController helper :UserScore @@ -5,6 +7,10 @@ class TestController < ApplicationController def bootstrap; end + def view_office + + end + def zip homeworks_attach_path = [] homework_id = params[:homework_id] diff --git a/config/routes.rb b/config/routes.rb index 9a8e71156..109e71c32 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,6 +110,7 @@ RedmineApp::Application.routes.draw do match 'courselist' match 'zip' match 'mailer' + match 'view_office' end ##new added by linchun #以发布应用的形式参与竞赛 resources :softapplications do From b3abf610d9390e66f3991c0bb33d039a8a8c4fa5 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 1 Jun 2015 23:10:25 +0800 Subject: [PATCH 134/134] add rest_client --- Gemfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index c1f7bcbeb..660a7ff49 100644 --- a/Gemfile +++ b/Gemfile @@ -6,10 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end -source 'http://rubygems.oneapm.com' do - gem 'oneapm_rpm' -end - +gem 'rest-client' gem "mysql2", "= 0.3.18" gem 'redis-rails' gem 'rubyzip'