diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 08ab010da..d266f5990 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -79,6 +79,8 @@ class CoursesController < ApplicationController end end + + def join_private_courses respond_to do |format| format.js @@ -196,28 +198,102 @@ class CoursesController < ApplicationController end end + def searchmembers + @render_file = 'member_list' + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + q = "#{params[:name].strip}" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + @results = searchStudent_by_name(@course, q) + @result_count = @results.count + @results = paginateHelper @results + + end + + def addgroups + if params[:group_name] + group = CourseGroup.new + group.name = params[:group_name] + group.course_id = @course.id + group.save + end + @course_groups = @course.course_groups + end + + def updategroupname + if params[:group_name] + group = CourseGroup.find(params[:group_id]) + group.name = params[:group_name] + group.save + end + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @course_groups = @course.course_groups + end + def join_group + group = CourseGroup.find(params[:object_id]) + member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member.course_group_id = group.id + member.save + @group = group + + search_group_members group + end + def unjoin_group + group = CourseGroup.find(params[:object_id]) + member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member.course_group_id = 0 + member.save + @group = group + + search_group_members group + end + def searchgroupmembers + @render_file = 'member_list' + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + if params[:group_id] && params[:group_id] != "0" + @group = CourseGroup.find(params[:group_id]) + @results = searchStudent_by_group(@group, @course) + else + @results = searchStudent(@course) + end + + @results = paginateHelper @results + end + def search_group_members group + @render_file = 'member_list' + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + + @results = searchStudent_by_group(group, @course) + @results = paginateHelper @results + end def member ## 有角色参数的才是课程,没有的就是项目 - if User.current.member_of_course?(@course) || User.current.admin? - @render_file = 'member_list' - @teachers= searchTeacherAndAssistant(@course) - @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' - case params[:role] - when '1' - @subPage_title = l :label_teacher_list - @members = searchTeacherAndAssistant(@course) - when '2' - @subPage_title = l :label_student_list - @members = searchStudent(@course) + @render_file = 'member_list' + @teachers= searchTeacherAndAssistant(@course) + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @role = params[:role] + @course_groups = @course.course_groups if @course.course_groups + @course_group_id = params[:@course_group_id] unless params[:@course_group_id].nil? + case params[:role] + when '1' + @subPage_title = l :label_teacher_list + @members = searchTeacherAndAssistant(@course) + when '2' + @subPage_title = l :label_student_list + if @course_group_id + @members = search_student_in_group(@course, @course_group_id) else - @subPage_title = '' - @members = @course.member_principals.includes(:roles, :principal).all.sort - end - @members = paginateHelper @members - render :layout => 'base_courses' - else - render_403 + @members = searchStudent(@course) + end + else + @subPage_title = '' + @members = @course.member_principals.includes(:roles, :principal).all.sort end + @members = paginateHelper @members + render :layout => 'base_courses' end #判断指定用户是否为课程教师 @@ -270,11 +346,12 @@ class CoursesController < ApplicationController @course.setup_time = params[:setup_time] @course.endup_time = params[:endup_time] @course.class_period = params[:class_period] + end - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all - if @course.save + if @course.save #unless User.current.admin? r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => User.current, :roles => [r]) @@ -300,16 +377,13 @@ class CoursesController < ApplicationController } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end - else + else #@course.destroy respond_to do |format| format.html { render :action => 'new', :layout => 'base' } #Added by young format.api { render_validation_errors(@course) } end - end - else - redirect_to my_account_url - end + end end def course @@ -669,29 +743,24 @@ class CoursesController < ApplicationController end def feedback - if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - page = params[:page] - # Find the page of the requested reply - @jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - if params[:r] && page.nil? - offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) - page = 1 + offset / @limit - end - - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, page - #@offset ||= @feedback_pages.offset - @jour = paginateHelper @jours,10 - @state = false - respond_to do |format| - format.html{render :layout => 'base_courses'} - format.api - end - else - render_403 + page = params[:page] + # Find the page of the requested reply + @jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @limit = 10 + if params[:r] && page.nil? + offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) + page = 1 + offset / @limit end + #@feedback_count = @jours.count + #@feedback_pages = Paginator.new @feedback_count, @limit, page + #@offset ||= @feedback_pages.offset + @jour = paginateHelper @jours,10 + @state = false + respond_to do |format| + format.html{render :layout => 'base_courses'} + format.api + end end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index d2b92c6e1..3b7e811f6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -155,7 +155,7 @@ module CoursesHelper members end - def searchStudent project + def search_student_in_group(project, course_group_id) #searchPeopleByRoles(project, StudentRoles) members = [] project.members.each do |m| @@ -163,6 +163,35 @@ module CoursesHelper end members end + def searchStudent project + #searchPeopleByRoles(project, StudentRoles) + members = [] + project.members.each do |m| + members << m if m && m.user && m.user.allowed_to?(:as_student,project) + end + members + end + def searchStudent_by_name project, name + #searchPeopleByRoles(project, StudentRoles) + members = [] + project.members.each do |m| + if m && m.user && m.user.allowed_to?(:as_student,project) + username = m.user[:lastname].to_s + m.user[:firstname].to_s + if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name)) + members << m + end + end + end + members + end + def searchStudent_by_group group, project + #searchPeopleByRoles(project, StudentRoles) + members = [] + group.members.each do |m| + members << m if m && m.user && m.user.allowed_to?(:as_student,project) + end + members + end # ===================================================================================== #def searchCountByRoles project, roles_id diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index b9d254143..8acd0b577 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -108,6 +108,37 @@ module WatchersHelper link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :class => []+options end end + def join_in_course_group(coursegroups,group, user, options=[]) + return '' unless user && user.logged? + + @isjoin = false + coursegroups.each do |g| + g.members.each do |mem| + if mem.user_id == user.id + @isjoin = true + end + end + end + url_t = join_group_path(:object_id => group.id) + url_f = join_group_path(:object_id => group.id) + if @isjoin == true + joined = user.member_of_course_group?(group) + text = l(:label_exit_course) + + if joined + link_to text, {:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, + :remote => true, :method => 'delete', + :id => "#{group.id}", :style => "padding: 8px 8px 4px;", + :confirm => l(:text_are_you_sure_out_group), :class => 'group_in' + + end + else + text = l(:label_new_join) + form_tag({:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, :remote => true, :method => 'post') do + submit_tag text, class: "group_in", style: "width: 43px;height: 21px;" + end + end + end # 用户是否允许加入课程判断 # add by nwb @@ -124,7 +155,8 @@ module WatchersHelper if joined link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options else - link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options + + link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options end end diff --git a/app/models/course.rb b/app/models/course.rb index 05b96414b..ef42d91e8 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -29,6 +29,8 @@ class Course < ActiveRecord::Base has_many :news, :dependent => :destroy, :include => :author has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy + has_many :course_groups, :dependent => :destroy + acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy acts_as_attachable :view_permission => :view_course_files, diff --git a/app/models/course_group.rb b/app/models/course_group.rb new file mode 100644 index 000000000..6126352f6 --- /dev/null +++ b/app/models/course_group.rb @@ -0,0 +1,21 @@ +class CourseGroup < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :course + has_many :members + has_many :memberships, :class_name => 'Member' + has_many :member_principals, :class_name => 'Member', + :include => :principal, + :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})" + has_many :principals, :through => :member_principals, :source => :principal + has_many :users, :through => :members + + before_destroy :set_member_nil + + attr_accessible :name + + def set_member_nil + if self.members && self.members.count > 0 + self.members.update_all("course_group_id = 0") + end + end +end diff --git a/app/models/member.rb b/app/models/member.rb index 46aefbd09..716f6a7c5 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -24,6 +24,7 @@ class Member < ActiveRecord::Base belongs_to :project belongs_to :course + belongs_to :course_group validates_presence_of :principal validates_uniqueness_of :user_id, :scope => [:project_id,:course_id] validate :validate_role diff --git a/app/models/principal.rb b/app/models/principal.rb index 024480635..2eaba6796 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -26,10 +26,11 @@ class Principal < ActiveRecord::Base has_many :members, :foreign_key => 'user_id', :dependent => :destroy has_many :memberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :project, :roles ], :conditions => "#{Project.table_name}.status<>#{Project::STATUS_ARCHIVED}", :order => "#{Project.table_name}.name" - has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :conditions => "#{Course.table_name}.status<>#{Course::STATUS_ARCHIVED}", :order => "#{Course.table_name}.name" + has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :order => "#{Course.table_name}.name" has_many :projects, :through => :memberships #add by nwb has_many :courses, :through => :coursememberships + has_many :course_groups, :through => :coursememberships has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify # Groups and active users diff --git a/app/models/user.rb b/app/models/user.rb index 29709519d..70e4e8187 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -690,6 +690,9 @@ class User < Principal courses.to_a.include?(course) end + def member_of_course_group?(course_group) + course_groups.to_a.include?(course_group) + end # Returns a hash of user's projects grouped by roles def projects_by_role return @projects_by_role if @projects_by_role diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb new file mode 100644 index 000000000..151eb9c7e --- /dev/null +++ b/app/views/courses/_groups_name.html.erb @@ -0,0 +1,60 @@ + + + + + + + diff --git a/app/views/courses/_member_list.html.erb b/app/views/courses/_member_list.html.erb index a6ee0b9b4..436a339dd 100644 --- a/app/views/courses/_member_list.html.erb +++ b/app/views/courses/_member_list.html.erb @@ -1,4 +1,17 @@ +
+<% if @group %> + <% if !@canShowCode %> + <%= join_in_course_group(@course.course_groups,@group, User.current) %> + <% end %>    + <%= @group.name %><%= @subPage_title %> + +<% end %> +
+ <% if members.any? %> + <% if @result_count %> +

<%= l(:label_search_member_count) %><%= @result_count %><%= l(:label_member_people) %>

+ <% end %> <% members.each do |member| %>
<% next if member.new_record? %> diff --git a/app/views/courses/addgroups.js.erb b/app/views/courses/addgroups.js.erb new file mode 100644 index 000000000..a6f6933b9 --- /dev/null +++ b/app/views/courses/addgroups.js.erb @@ -0,0 +1 @@ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); \ No newline at end of file diff --git a/app/views/courses/join_group.js.erb b/app/views/courses/join_group.js.erb new file mode 100644 index 000000000..d1901db83 --- /dev/null +++ b/app/views/courses/join_group.js.erb @@ -0,0 +1,2 @@ + +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index 3d3076bcc..5d596efeb 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,10 +1,28 @@ -
-

- <%= @subPage_title %> -

-
-
- <%= error_messages_for 'member' %> - <%= render :partial => @render_file, :locals => {:members => @members} %> +<%= stylesheet_link_tag 'course_group', :media => 'all' %> + +
+ +
+ +
+ <%= render :partial => 'groups_name', locals: {:course_groups => @course_groups} %> +
+ + +
+ +
+ <%= error_messages_for 'member' %> + <%= render :partial => @render_file, :locals => {:members => @members} %> +
diff --git a/app/views/courses/searchgroupmembers.js.erb b/app/views/courses/searchgroupmembers.js.erb new file mode 100644 index 000000000..c6ff97164 --- /dev/null +++ b/app/views/courses/searchgroupmembers.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/3. + */ +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/searchmembers.js.erb b/app/views/courses/searchmembers.js.erb new file mode 100644 index 000000000..efe47a9c0 --- /dev/null +++ b/app/views/courses/searchmembers.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/2. + */ +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/unjoin_group.js.erb b/app/views/courses/unjoin_group.js.erb new file mode 100644 index 000000000..d1901db83 --- /dev/null +++ b/app/views/courses/unjoin_group.js.erb @@ -0,0 +1,2 @@ + +$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/app/views/courses/updategroupname.js.erb b/app/views/courses/updategroupname.js.erb new file mode 100644 index 000000000..8eb4e865c --- /dev/null +++ b/app/views/courses/updategroupname.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/3. + */ +$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>"); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 23c9e8e06..cecc9b465 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -569,7 +569,9 @@ zh: label_role_plural: 角色 label_role_new: 新建角色 label_role_and_permissions: 角色和权限 - label_member: 成员 + label_member: + label_search_member_count: 共搜索到 + label_member_people: 人 label_member_new: 添加成员 label_member_plural: 成员 label_tracker: 跟踪标签 @@ -1120,6 +1122,7 @@ zh: text_workflow_edit: 选择角色和跟踪标签来编辑工作流程 text_are_you_sure: 您确定要删除吗? text_are_you_sure_out: 你确定要退出该课程吗? + text_are_you_sure_out_group: 你确定要退出该分组吗? text_journal_changed: "%{label} 从 %{old} 变更为 %{new}" text_journal_set_to: "%{label} 被设置为 %{value}" text_journal_deleted: "%{label} 已删除 (%{old})" diff --git a/config/routes.rb b/config/routes.rb index 1d28a9ae6..835e6be6e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -643,10 +643,16 @@ RedmineApp::Application.routes.draw do get 'member', :controller => 'courses', :action => 'member', :as => 'member' post 'finishcourse' post 'restartcourse' - + match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] + match "searchgroupmembers", :via => [:post, :get] + match "updategroupname", :via => [:post, :get] + match "addgroups", :via => [:post, :get] + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + delete 'join_in/join_group', :to => 'courses#unjoin_group' end collection do match 'join_private_courses', :via => [:get, :post] + end match '/member', :to => 'courses#member', :as => 'member', :via => :get @@ -739,6 +745,8 @@ RedmineApp::Application.routes.draw do post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + delete 'join_in/join_group', :to => 'courses#unjoin_group' post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest' delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest' match 'calls/:id/show_participator', :to => 'bids#show_participator' # bai @@ -747,6 +755,7 @@ RedmineApp::Application.routes.draw do delete 'attachment/:id', :to => 'attachments#delete_homework' match 'new_join', :to => 'courses#new_join', :as => 'try_join' + match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest' match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post] diff --git a/db/migrate/20141126091207_create_course_groups.rb b/db/migrate/20141126091207_create_course_groups.rb new file mode 100644 index 000000000..2ee849b6f --- /dev/null +++ b/db/migrate/20141126091207_create_course_groups.rb @@ -0,0 +1,11 @@ +class CreateCourseGroups < ActiveRecord::Migration + def change + create_table :course_groups do |t| + t.string :name + t.integer :course_id + + + t.timestamps + end + end +end diff --git a/db/migrate/20141126091750_add_column_to_members.rb b/db/migrate/20141126091750_add_column_to_members.rb new file mode 100644 index 000000000..ce1ac7a75 --- /dev/null +++ b/db/migrate/20141126091750_add_column_to_members.rb @@ -0,0 +1,5 @@ +class AddColumnToMembers < ActiveRecord::Migration + def change + add_column :members, :course_group_id, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 883dd74c5..6e335db19 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1318,3 +1318,1330 @@ ActiveRecord::Schema.define(:version => 20141201085218) do end end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20141126091750) 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 "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" + 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 "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 "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 + 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" + 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 "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 "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 + 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 + 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 + +end diff --git a/public/images/btn.png b/public/images/btn.png new file mode 100644 index 000000000..85cea7f5c Binary files /dev/null and b/public/images/btn.png differ diff --git a/public/images/btn1.png b/public/images/btn1.png new file mode 100644 index 000000000..f7f7f1c77 Binary files /dev/null and b/public/images/btn1.png differ diff --git a/public/images/close2.png b/public/images/close2.png new file mode 100644 index 000000000..301ba5e85 Binary files /dev/null and b/public/images/close2.png differ diff --git a/public/images/inputBg.png b/public/images/inputBg.png new file mode 100644 index 000000000..243bbf7ec Binary files /dev/null and b/public/images/inputBg.png differ diff --git a/public/images/pic_edit.png b/public/images/pic_edit.png new file mode 100644 index 000000000..fc2f3ae13 Binary files /dev/null and b/public/images/pic_edit.png differ diff --git a/public/images/pic_up.png b/public/images/pic_up.png new file mode 100644 index 000000000..84401074a Binary files /dev/null and b/public/images/pic_up.png differ diff --git a/public/javascripts/application.js.bak b/public/javascripts/application.js.bak deleted file mode 100644 index 0c09ffb03..000000000 --- a/public/javascripts/application.js.bak +++ /dev/null @@ -1,696 +0,0 @@ -//= require_directory ./rateable -/* Redmine - project management software - Copyright (C) 2006-2013 Jean-Philippe Lang */ - -function cleanArray (actual){ - var newArray = new Array(); - for (var i = 0; i< actual.length; i++){ - if (actual[i]){ - newArray.push(actual[i]); - } - } - return newArray; -} - -function checkAll(id, checked) { - if (checked) { - $('#'+id).find('input[type=checkbox]').attr('checked', true); - } else { - $('#'+id).find('input[type=checkbox]').removeAttr('checked'); - } -} - -function toggleCheckboxesBySelector(selector) { - var all_checked = true; - $(selector).each(function(index) { - if (!$(this).is(':checked')) { all_checked = false; } - }); - $(selector).attr('checked', !all_checked); -} - -function showAndScrollTo(id, focus) { - $('#'+id).show(); - if (focus !== null) { - $('#'+focus).focus(); - } - $('html, body').animate({scrollTop: $('#'+id).offset().top}, 400); -} - -function toggleRowGroup(el) { - var tr = $(el).parents('tr').first(); - var n = tr.next(); - tr.toggleClass('open'); - while (n.length && !n.hasClass('group')) { - n.toggle(); - n = n.next('tr'); - } -} - -function collapseAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).removeClass('open'); - } else { - $(this).hide(); - } - }); -} - -function expandAllRowGroups(el) { - var tbody = $(el).parents('tbody').first(); - tbody.children('tr').each(function(index) { - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleAllRowGroups(el) { - var tr = $(el).parents('tr').first(); - if (tr.hasClass('open')) { - collapseAllRowGroups(el); - } else { - expandAllRowGroups(el); - } -} - -function toggleFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').toggle(); -} - -function hideFieldset(el) { - var fieldset = $(el).parents('fieldset').first(); - fieldset.toggleClass('collapsed'); - fieldset.children('div').hide(); -} - -function initFilters(){ - $('#add_filter_select').change(function(){ - addFilter($(this).val(), '', []); - }); - $('#filters-table td.field input[type=checkbox]').each(function(){ - toggleFilter($(this).val()); - }); - $('#filters-table td.field input[type=checkbox]').live('click',function(){ - toggleFilter($(this).val()); - }); - $('#filters-table .toggle-multiselect').live('click',function(){ - toggleMultiSelect($(this).siblings('select')); - }); - $('#filters-table input[type=text]').live('keypress', function(e){ - if (e.keyCode == 13) submit_query_form("query_form"); - }); -} - -function addFilter(field, operator, values) { - var fieldId = field.replace('.', '_'); - var tr = $('#tr_'+fieldId); - if (tr.length > 0) { - tr.show(); - } else { - buildFilterRow(field, operator, values); - } - $('#cb_'+fieldId).attr('checked', true); - toggleFilter(field); - $('#add_filter_select').val('').children('option').each(function(){ - if ($(this).attr('value') == field) { - $(this).attr('disabled', true); - } - }); -} - -function buildFilterRow(field, operator, values) { - var fieldId = field.replace('.', '_'); - var filterTable = $("#filters-table"); - var filterOptions = availableFilters[field]; - var operators = operatorByType[filterOptions['type']]; - var filterValues = filterOptions['values']; - var i, select; - - var tr = $('').attr('id', 'tr_'+fieldId).html( - '' + - '' + - ' 复选/multi-select' - ); - select = tr.find('td.values select'); - if (values.length > 1) { select.attr('multiple', true); } - for (i=0;i'); - if ($.isArray(filterValue)) { - option.val(filterValue[1]).text(filterValue[0]); - if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);} - } else { - option.val(filterValue).text(filterValue); - if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);} - } - select.append(option); - } - break; - case "date": - case "date_past": - tr.find('td.values').append( - '' + - ' ' + - ' '+labelDayPlural+'' - ); - $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); - $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); - $('#values_'+fieldId).val(values[0]); - break; - case "string": - case "text": - tr.find('td.values').append( - '' - ); - $('#values_'+fieldId).val(values[0]); - break; - case "relation": - tr.find('td.values').append( - '' + - '' - ); - $('#values_'+fieldId).val(values[0]); - select = tr.find('td.values select'); - for (i=0;i'); - option.val(filterValue[1]).text(filterValue[0]); - if (values[0] == filterValue[1]) { option.attr('selected', true); } - select.append(option); - } - case "integer": - case "float": - tr.find('td.values').append( - '' + - ' ' - ); - $('#values_'+fieldId+'_1').val(values[0]); - $('#values_'+fieldId+'_2').val(values[1]); - break; - } -} - -function toggleFilter(field) { - var fieldId = field.replace('.', '_'); - if ($('#cb_' + fieldId).is(':checked')) { - $("#operators_" + fieldId).show().removeAttr('disabled'); - toggleOperator(field); - } else { - $("#operators_" + fieldId).hide().attr('disabled', true); - enableValues(field, []); - } -} - -function enableValues(field, indexes) { - var fieldId = field.replace('.', '_'); - $('#tr_'+fieldId+' td.values .value').each(function(index) { - if ($.inArray(index, indexes) >= 0) { - $(this).removeAttr('disabled'); - $(this).parents('span').first().show(); - } else { - $(this).val(''); - $(this).attr('disabled', true); - $(this).parents('span').first().hide(); - } - - if ($(this).hasClass('group')) { - $(this).addClass('open'); - } else { - $(this).show(); - } - }); -} - -function toggleOperator(field) { - var fieldId = field.replace('.', '_'); - var operator = $("#operators_" + fieldId); - switch (operator.val()) { - case "!*": - case "*": - case "t": - case "ld": - case "w": - case "lw": - case "l2w": - case "m": - case "lm": - case "y": - case "o": - case "c": - enableValues(field, []); - break; - case "><": - enableValues(field, [0,1]); - break; - case "t+": - case ">t-": - case "0) { - lis.eq(i-1).show(); - } -} - -function displayTabsButtons() { - var lis; - var tabsWidth = 0; - var el; - $('div.tabs').each(function() { - el = $(this); - lis = el.find('ul').children(); - lis.each(function(){ - if ($(this).is(':visible')) { - tabsWidth += $(this).width() + 6; - } - }); - if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) { - el.find('div.tabs-buttons').hide(); - } else { - el.find('div.tabs-buttons').show(); - } - }); -} - -function setPredecessorFieldsVisibility() { - var relationType = $('#relation_relation_type'); - if (relationType.val() == "precedes" || relationType.val() == "follows") { - $('#predecessor_fields').show(); - } else { - $('#predecessor_fields').hide(); - } -} - -function showModal(id, width) { - var el = $('#'+id).first(); - if (el.length === 0 || el.is(':visible')) {return;} - var title = el.find('h3.title').text(); - el.dialog({ - width: width, - modal: true, - resizable: false, - dialogClass: 'modal', - title: title - }); - el.find("input[type=text], input[type=submit]").first().focus(); -} - -function hideModal(el) { - var modal; - if (el) { - modal = $(el).parents('.ui-dialog-content'); - } else { - modal = $('#ajax-modal'); - } - modal.dialog("close"); -} - -function submitPreview(url, form, target) { - $.ajax({ - url: url, - type: 'post', - beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, - data: $('#'+form).serialize(), - success: function(data){ - $('#'+target).html(data); - } - }); -} - -function collapseScmEntry(id) { - $('.'+id).each(function() { - if ($(this).hasClass('open')) { - collapseScmEntry($(this).attr('id')); - } - $(this).hide(); - }); - $('#'+id).removeClass('open'); -} - -function expandScmEntry(id) { - $('.'+id).each(function() { - $(this).show(); - if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) { - expandScmEntry($(this).attr('id')); - } - }); - $('#'+id).addClass('open'); -} - -function scmEntryClick(id, url) { - el = $('#'+id); - if (el.hasClass('open')) { - collapseScmEntry(id); - el.addClass('collapsed'); - return false; - } else if (el.hasClass('loaded')) { - expandScmEntry(id); - el.removeClass('collapsed'); - return false; - } - if (el.hasClass('loading')) { - return false; - } - el.addClass('loading'); - $.ajax({ - url: url, - success: function(data){ - el.after(data); - el.addClass('open').addClass('loaded').removeClass('loading'); - } - }); - return true; -} - -function randomKey(size) { - var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); - var key = ''; - for (i = 0; i < size; i++) { - key += chars[Math.floor(Math.random() * chars.length)]; - } - return key; -} - -// Can't use Rails' remote select because we need the form data -function updateIssueFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#issue-form').serialize() - }); -} - -function updateBulkEditFrom(url) { - $.ajax({ - url: url, - type: 'post', - data: $('#bulk_edit_form').serialize() - }); -} - -function clearMessage(id) { - $('#'+id).val(""); -} - - -function observeAutocompleteField(fieldId, url, options) { - $(document).ready(function() { - $('#'+fieldId).autocomplete($.extend({ - source: url, - select: function(e,ui){self.location="/issues/"+ui.item.value;}, - minLength: 2, - search: function(){$('#'+fieldId).addClass('ajax-loading');}, - response: function(){$('#'+fieldId).removeClass('ajax-loading'); - } - }, options)); - $('#'+fieldId).addClass('autocomplete'); - - }); - -} - -function observeSearchfield(fieldId, targetId, url) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {q: $this.val()}, - success: function(data){ if(targetId) $('#'+targetId).html(data); }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); -} - -function observeProjectModules() { - var f = function() { - /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */ - if ($('#project_enabled_module_names_issue_tracking').attr('checked')) { - $('#project_trackers').show(); - }else{ - $('#project_trackers').hide(); - } - }; - - $(window).load(f); - $('#project_enabled_module_names_issue_tracking').change(f); -} - -function initMyPageSortable(list, url) { - $('#list-'+list).sortable({ - connectWith: '.block-receiver', - tolerance: 'pointer', - update: function(){ - $.ajax({ - url: url, - type: 'post', - data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})} - }); - } - }); - $("#list-top, #list-left, #list-right").disableSelection(); -} - -var warnLeavingUnsavedMessage; -function warnLeavingUnsaved(message) { - warnLeavingUnsavedMessage = message; - - $('form').submit(function(){ - $('textarea').removeData('changed'); - }); - $('textarea').change(function(){ - $(this).data('changed', 'changed'); - }); - window.onbeforeunload = function(){ - var warn = false; - $('textarea').blur().each(function(){ - if ($(this).data('changed')) { - warn = true; - } - }); - if (warn) {return warnLeavingUnsavedMessage;} - }; -} - -function setupAjaxIndicator() { - - $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) { - - if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') { - $('#ajax-indicator').show(); - } - }); - - $('#ajax-indicator').bind('ajaxStop', function() { - $('#ajax-indicator').hide(); - }); -} - -function hideOnLoad() { - $('.hol').hide(); -} - -function addFormObserversForDoubleSubmit() { - $('form[method=post]').each(function() { - if (!$(this).hasClass('multiple-submit')) { - $(this).submit(function(form_submission) { - if ($(form_submission.target).attr('data-submitted')) { - form_submission.preventDefault(); - } else { - $(form_submission.target).attr('data-submitted', true); - } - }); - } - }); -} - -function blockEventPropagation(event) { - event.stopPropagation(); - event.preventDefault(); -} - -function toggleAndSettingWordsVal(parent_widget, text_widget, value){ - text_widget.val(value) - parent_widget.slideToggle(400) -} -function transpotUrl (scope) { - $(scope).each(function(){ - var tmpContent = $(this).html(); - tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); - // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); - $(this).html(tmpContent); - }); -} - -$(document).ready(setupAjaxIndicator); -$(document).ready(hideOnLoad); -$(document).ready(addFormObserversForDoubleSubmit); -$(document).ready(function(){ - $.ajaxSetup({ - headers: { - 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') - } - }); - } -) - -function img_thumbnails() { - $('.thumbnails a').colorbox({rel:'nofollow'}); - $('.attachments').find('a').each(function(index, element) { - var href_value = $(element).attr('href'); - if (/\.(jpg|png|gif|bmp)$/.test(href_value)) { - $(element).colorbox({rel:'nofollow'}); - } - - }); -} -$(document).ready(img_thumbnails); - -function TimeClose(dateText, inst) { - if(inst.id=="issue_start_date"){ - time=dateText; - } -} -var time=new Date(); -function TimeBeforeShow(input){ - if(input.id=="issue_due_date"){ - //var minDate = $(input).datepicker('option', 'minDate'); - var tempdata=$("#issue_start_date").attr("value"); - - $(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/"))); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - } -} - -function SetMinValue(){ - /// var tempdata=$("#issue_start_date").attr("value"); - //$('.selector').datepicker('option', 'minDate', '12/25/2012'); - //alert(tempdata); - //$("#issue_due_date").datepicker({ - // minDate: new Date(2014,08,23) - //var datepickerOptions= - //{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; - //alert( $('.issue_due_date').length); - //$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23)); - //$("#issue_due_date").datepicker(datepickerOptions); - //$("##{issue_due_date}").datepicker(datepickerOptions); - //$("#issue_due_date").datepicker( - // {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true} - //) - //}); -} -function PrecentChange(obj){ - var _v= obj; - if(_v==100) - { - //var select=$("select[id='issue_status_id']"); - $("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected"); - } - else if(_v==0) - { - //alert(1); - $("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected"); - } - else if(_v!=100&&_v!=0) - { - // alert(2); - $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected"); - } -} diff --git a/public/stylesheets/course_group.css b/public/stylesheets/course_group.css new file mode 100644 index 000000000..10d69f384 --- /dev/null +++ b/public/stylesheets/course_group.css @@ -0,0 +1,96 @@ +body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} +div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;} +div,img,tr,td,textarea,form{ border:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} +ul,li{ list-style-type:none} +.cl{ clear:both; overflow:hidden; } +a{ text-decoration:none; } +a:hover{ } +/**** 常用***/ +.f_l{ float:left;} +.f_r{ float:right;} +.b_lblue{ background:#64bdd9;} +.b_dblue{ background:#55a1b9; cursor:pointer;} +.f_b{ font-weight: bold;} +.c_blue{ color:#64bdd9;} +.c_grey{ color:#999999;} +.c_grey02{ color:#666666;} +.f_14{ font-size:14px;} +.c_dblue{ color:#3e6d8e;} +.c_red{ color:#ec0016;} +.w90{width:90px;} +.ml10{margin-left:10px;} +.st_search input.f_2 { + width:60px !important; + height:28px !important; + color:#fff !important; + margin-right:5px !important; + border:none !important; + margin-left:0px !important; + box-shadow: none !important; + padding: 0px !important; + border-radius: 0 !important; + text-shadow: none !important; + border:1px solid #1c9ec7; + background:#1c9ec7; + +} +.container{ width:940px; margin:0 auto; font-size:12px;} + +.st_list{ width:688px; padding-left:5px; height:800px;} +.st_search{ margin:10px 0;} +.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} +.st_search input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px;} +.st_search a:hover{ background:#048fbb; text-decoration:none;} +/*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/ + +.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} +.st_addclass{ margin-top:5px;} +.st_addclass ul li{ margin-bottom:10px;} +.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;} +.st_addclass img{ margin-top:3px;} +.st_addclass a{ color:#0d90c3;} + +.st_box{ margin-top:10px; border-top:1px solid #CCC; padding-top:10px;} +.st_box ul li{ float:left;} +.st_box_top a{ font-weight:bold; color:#7a7a7a; float:left;} +.st_box_top a:hover{ color:#1c9ec7;} +.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} +.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} +a.st_img { display:block;width:40px; height:40px; border:1px solid #CCC; padding:1px;} +a:hover.st_img { border:1px solid #1c9ec7; } +.st_boxlist{ border-bottom:1px dashed #CCC; height:53px; padding-top:10px; } +.st_boxlist a{ float:left;} +.st_boxlist ul{ float:left; width:200px; margin-left:10px;} +.st_boxlist ul li a{ color:#5d5d5d;} +.st_boxlist ul li a span{ color:#1c9ec7;} +.st_boxlist ul li a:hover span{ color:#ff8e15;} +.ml50{ margin-left:50px;} +.ml358{ margin-left:358px;} +.ml258{ margin-left:254px;} +.ml65{ margin-left:65px;} +a:hover.st_add{ color:#ff8e15;} + +/****翻页***/ +.wlist{ margin-top:15px; float:right;} +.wlist a{ float:left; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;} +.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;} +.wlist_select a { background-color:#64bdd9; color:#fff;} + +.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.submit_2{height:21px;border:0; cursor:pointer; background:url(../images/btn1.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} +.group_in { + width:60px !important; + height:28px !important; + color:#fff !important; + margin-right:5px !important; + border:none !important; + margin-left:0px !important; + box-shadow: none !important; + + border-radius: 0 !important; + text-shadow: none !important; + border:1px solid #1c9ec7; + background:#1c9ec7; +} \ No newline at end of file diff --git a/test/fixtures/course_groups.yml b/test/fixtures/course_groups.yml new file mode 100644 index 000000000..c63aac0b6 --- /dev/null +++ b/test/fixtures/course_groups.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/unit/course_group_test.rb b/test/unit/course_group_test.rb new file mode 100644 index 000000000..c08ede23f --- /dev/null +++ b/test/unit/course_group_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CourseGroupTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end