diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb
index b9824976b..d779c7759 100644
--- a/app/controllers/applied_project_controller.rb
+++ b/app/controllers/applied_project_controller.rb
@@ -1,44 +1,70 @@
class AppliedProjectController < ApplicationController
-
+ helper :watchers
#申请加入项目
def applied_join_project
- @user_id = params[:user_id]
- @project = Project.find_by_id(params[:project_id])
- if params[:project_join]
- if @project
- user = User.find @user_id
- if user.member_of?(@project)
- @status = 3
- else
- @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
- if @applieds.count == 0
- appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
- Mailer.run.applied_project(appliedproject)
- @status = 2
- else
- @status = 1
- end
- end
- else
- @status = 0
- end
- respond_to do |format|
- format.js
- end
- return
+ if params[:object_id]
+ @project = Project.find_by_id(params[:object_id])
end
+ # @user_id = params[:user_id]
+ # if params[:project_join]
+ # if @project
+ # user = User.find @user_id
+ # if user.member_of?(@project)
+ # @status = 3
+ # else
+ # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
+ # if @applieds.count == 0
+ # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
+ # Mailer.run.applied_project(appliedproject)
+ # @status = 2
+ # else
+ # @status = 1
+ # end
+ # end
+ # else
+ # @status = 0
+ # end
+ # respond_to do |format|
+ # format.js
+ # end
+ # return
+ # end
+ #
+ # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
+ # if @applieds.count == 0
+ # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
+ # Mailer.run.applied_project(appliedproject)
+ # end
+ #
+ # #redirect_to project_path(params[:project_id])
+ # #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
+ # respond_to do |format|
+ # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
+ # format.js { render :partial => 'set_applied'}
+ # end
+ end
- @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
- if @applieds.count == 0
- appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
- Mailer.run.applied_project(appliedproject)
+ # @flage:提示语标志(1:邀请码错误;2:已经是项目成员; 3:角色没有选择; 4:申请成功)
+ # role:成员角色 => 0(4:管理人员;5:开发人员;6:报告人员)
+ # 申请成功则发送消息
+ def applied_project_info
+ if params[:project_id].nil?
+ @project = Project.where(:invite_code => params[:invite_code]).first
+ else
+ @project = Project.find(params[:project_id])
end
-
- #redirect_to project_path(params[:project_id])
- #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
- respond_to do |format|
- format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
- format.js { render :partial => 'set_applied'}
+ if !@project || params[:invite_code].to_s != @project.invite_code
+ @flag = 1
+ elsif User.current.member_of?(@project)
+ @flag = 2
+ elsif params[:member].nil?
+ @flag = 3
+ else
+ @flag = 4
+ role = params[:member] == "member_manager" ? 3 : (params[:member] = "member_developer" ? 4 :5)
+ applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => @project.id, :role => role)
+ # 申请成功则给项目管理员发送邮件及发送消息
+ Mailer.run.applied_project(applied_project)
end
end
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index a38cc8d34..2614b6271 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -23,7 +23,7 @@ class CoursesController < ApplicationController
before_filter :can_show_course, :except => []
before_filter :logged_user_by_apptoken,:only => [:show,:feedback]
- before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses]
+ before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role]
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
before_filter :authorize_course_global, :only => [:new,:create]
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
@@ -81,6 +81,22 @@ class CoursesController < ApplicationController
end
+ def join_course_multi_role
+ if User.current.logged?
+ cs = CoursesService.new
+ @user = User.current
+ join = cs.join_course_roles params,@user
+ @state = join[:state]
+ @course = join[:course]
+ else
+ @state = 5 #未登录
+ end
+ @object_id = @course.id if @course
+ respond_to do |format|
+ format.js
+ end
+ end
+
def unjoin
if User.current.logged?
cs = CoursesService.new
@@ -1136,6 +1152,21 @@ class CoursesController < ApplicationController
end
end
+ #切换身份
+ def switch_role
+ members = @course.members.where("user_id = #{params[:user_id]}")
+ unless members.blank?
+ #role = MemberRole.where("member_id = #{members.first.id} and role_id = #{params[:role]}").first
+ curr_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:curr_role])
+ tar_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:tar_role])
+ unless (curr_role.nil? || tar_role.nil?)
+ curr_role.update_column('is_current', 0)
+ tar_role.update_column('is_current', 1)
+ end
+ end
+ redirect_to course_path(@course)
+ end
+
private
def update_quotes attachment
if attachment.copy_from
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 4dc2c52f5..0a76cfb78 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -17,10 +17,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MembersController < ApplicationController
+ helper :users
model_object Member
- before_filter :find_model_object, :except => [:index, :create, :autocomplete]
+ before_filter :find_model_object, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
#before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete]
- before_filter :find_project_from_association, :except => [:index, :create, :autocomplete]
+ before_filter :find_project_from_association, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
before_filter :find_project_by_project_id, :only => [:index, :create, :autocomplete]
before_filter :authorize
accept_api_auth :index, :show, :create, :update, :destroy
@@ -49,6 +50,62 @@ class MembersController < ApplicationController
end
end
+ # 同意消息中申请加入项目
+ # 之所以role不在参数中传送是考虑到安全问题
+ # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:决绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
+ def allow_to_join_project
+ @applied_message = AppliedMessage.find(params[:applied_message_id])
+ applied_project = @applied_message.applied
+ user = User.find(@applied_message.applied_user_id)
+ project = Project.find(applied_project.project_id)
+ if user.member_of?(project)
+ @flash_message = "您已经是项目成员了"
+ @applied_message.update_attribute(:status, 2)
+ else
+ ap_role = applied_project.try(:role)
+ if ap_role
+ begin
+ members = []
+ user_grades = []
+ project_info = []
+ members << Member.new(:role_ids => ["#{ap_role}"], :user_id => @applied_message.applied_user_id)
+ user_grades << UserGrade.new(:user_id => @applied_message.applied_user_id, :project_id => project.id)
+ role = Role.find(ap_role)
+ project_info << ProjectInfo.new(:project_id => project.id, :user_id => @applied_message.applied_user_id) if role.allowed_to?(:is_manager)
+ project.members << members
+ project.project_infos << project_info
+ project.user_grades << user_grades unless user_grades.first.user_id.nil?
+ @applied_message.update_attribute(:status, 2)
+ # 添加成功后,申请人收到消息
+ AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
+ :status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
+ # 添加成功后,批准人收到消息
+ AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
+ :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
+ rescue Exception => e
+ puts e
+ end
+ end
+ end
+ end
+
+ # 同意消息中拒绝加入项目
+ # params[:user_id]为申请者ID
+ # params[:send_id]为拒绝人ID
+ # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
+ def refused_allow_to_join_project
+ @applied_message = AppliedMessage.find(params[:applied_message_id])
+ @applied_message.update_attribute(:status, 3)
+ applied_project = @applied_message.applied
+ # 发送消息给被拒者,user_id对应的收到信息的用户
+ AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
+ :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
+ # 发送消息给拒绝者
+ AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
+ :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
+ applied_project.delete
+ end
+
def create
if params[:refusal_button]
members = []
@@ -154,9 +211,11 @@ class MembersController < ApplicationController
user_ids = attrs.delete(:user_ids)
user_ids.each do |user_id|
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
- role = Role.find_by_id(params[:membership][:role_ids])
+
+ role_ids = attrs.delete(:role_ids)
+ #role = Role.find(params[:membership][:role_ids])
# 这里的判断只能通过角色名,可以弄成常量
- if role && (role.name == "学生" || role.name == "Student")
+ if role_ids && role_ids.include?("10")
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
end
@@ -252,7 +311,10 @@ class MembersController < ApplicationController
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
# 这里的判断只能通过角色名,可以弄成常量
- if role.name == "学生" || role.name == "Student"
+ attrs = params[:membership].dup
+ role_ids = attrs.delete(:role_ids)
+
+ if role_ids && role_ids.include?("10")
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
@@ -313,6 +375,11 @@ class MembersController < ApplicationController
grade.destroy
end
end
+ # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
+ applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first
+ unless applied_projects.nil?
+ applied_projects.delete
+ end
#移出项目发送消息
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
end
diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb
index 80c5a2468..c9873ade4 100644
--- a/app/controllers/quality_analysis_controller.rb
+++ b/app/controllers/quality_analysis_controller.rb
@@ -37,7 +37,7 @@ class QualityAnalysisController < ApplicationController
quality_an.delete unless quality_an.blank?
end
# Checks if the given job exists in Jenkins.
- unless @client.job.exists?(job_name)
+ # unless @client.job.exists?(job_name)
@g = Gitlab.client
branch = params[:branch]
language = swith_language_type(params[:language])
@@ -111,7 +111,7 @@ class QualityAnalysisController < ApplicationController
end
end
end
- end
+ # end
rescue => e
@message = e.message
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 5e968e854..2f1d6a4db 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -41,7 +41,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
- :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist]
+ :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@@ -133,6 +133,7 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@homepage = params[:homepage]
+ @user_id = params[:user_id]
@type = 'BlogComment'
when 'OrgDocumentComment'
@reply = OrgDocumentComment.find params[:reply_id]
@@ -149,6 +150,9 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Issue'
+ when 'Syllabus'
+ @reply = JournalsForMessage.find params[:reply_id]
+ @type = 'Syllabus'
end
respond_to do |format|
format.js
@@ -351,15 +355,21 @@ class UsersController < ApplicationController
case params[:agree]
when 'Y'
apply_user = User.find(@msg.course_message_id)
-
+ ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色
+ integer_ids = []
+ ids.each do |role_id|
+ integer_ids << role_id.to_i
+ end
if apply_user.member_of_course?(Course.find(@msg.course_id))
#将角色改为老师或者教辅
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
- member.role_ids = [@msg.content] # msg content保存的是申请的职位角色
- #删除为学生的记录
- joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
- joined.each do |join|
- join.delete
+ member.role_ids = integer_ids
+ #删除为学生的记录
+ unless member.role_ids.include?(10)
+ joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
+ joined.each do |join|
+ join.delete
+ end
end
member.course_group_id = 0
@@ -368,7 +378,7 @@ class UsersController < ApplicationController
@msg.update_attributes(:status=>1,:viewed=>1)
else
members = []
- members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
+ members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id)
Course.find(@msg.course_id).members << members
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
@@ -3225,7 +3235,35 @@ class UsersController < ApplicationController
end
def user_courselist
- @order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
+ @order, @c_sort, @type, @list_type = 1, 2, 1, 1
+
+ @my_syllabuses = @user.syllabuses
+
+ sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id)
+ syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
+ @join_syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}")
+
+ @my_syllabuses = syllabus_course_list_sort @my_syllabuses
+ @join_syllabuses = syllabus_course_list_sort @join_syllabuses
+ @my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
+ @join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
+
+ #分页
+ # @limit = 10
+ # @is_remote = true
+ # @atta_count = @syllabus.count
+ # @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
+ # @offset ||= @atta_pages.offset
+ # @syllabus = paginateHelper @syllabus,@limit
+
+ respond_to do |format|
+ format.html {render :layout => 'new_base_user'}
+ end
+ end
+
+ #课程列表的排序
+ def sort_syllabus_list
+ @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@@ -3235,40 +3273,48 @@ class UsersController < ApplicationController
end
sort_name = "updated_at"
- sort_type = @c_sort == 1 ? "asc" : "desc"
- @courses = @user.courses.visible.where("is_delete =?", 0)
- syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
- @syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}")
+ if @list_type.to_i == 1
+ @syllabuses = @user.syllabuses.order("updated_at desc")
+ else
+ sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id)
+ syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
+ @syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}").order("updated_at desc")
+ end
- #根据 作业+资源数排序
- if @order.to_i == 2
+ if @order.to_i == 1 #根据 班级更新时间排序
+ @syllabuses = syllabus_course_list_sort @syllabuses
+ @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]})
+ @type = 1
+ elsif @order.to_i == 2 #根据 作业+资源数排序
@type = 2
- @syllabus.each do |syllabus|
+ @syllabuses.each do |syllabus|
count = 0
- courses = @courses.where("syllabus_id = #{syllabus.id}")
+ courses = syllabus.courses.not_deleted
courses.each do |c|
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
end
syllabus[:infocount] = count
end
- @c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]})
- @syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name
+ @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]})
+ @syllabuses = sortby_time_countcommon_nosticky @syllabuses,sort_name
else
@type = 1
end
- #分页
- @limit = 10
- @is_remote = true
- @atta_count = @syllabus.count
- @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
- @offset ||= @atta_pages.offset
- @syllabus = paginateHelper @syllabus,@limit
-
respond_to do |format|
format.js
- format.html {render :layout => 'new_base_user'}
+ end
+ end
+
+ #展开课程下的班级
+ def expand_courses
+ @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first
+ unless @syllabus.nil?
+ @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
+ respond_to do |format|
+ format.js
+ end
end
end
@@ -3342,6 +3388,8 @@ class UsersController < ApplicationController
when 'Syllabus'
obj = Syllabus.where('id = ?', params[:id].to_i).first
@journals = obj.journals_for_messages.reorder("created_on desc")
+ @type = 'Syllabus'
+ @user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []
@@ -3358,6 +3406,7 @@ class UsersController < ApplicationController
@user_activity_id = params[:div_id].to_i if params[:div_id]
@homepage = params[:homepage].to_i
@type = 'BlogComment'
+ @user_id = obj.author_id
comments = []
@journals = get_all_children(comments, obj)
when 'HomeworkCommon'
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 828739cc4..499272706 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -112,6 +112,10 @@ class WordsController < ApplicationController
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
+ elsif @journal_destroyed.jour_type == 'Syllabus'
+ @syllabus = Syllabus.find @journal_destroyed.jour_id
+ @count = @syllabus.journals_for_messages.count
+ @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
end
respond_to do |format|
format.js
@@ -352,6 +356,35 @@ class WordsController < ApplicationController
render_403
end
end
+
+ #课程大纲的二级回复
+ def reply_to_syllabus
+ if User.current.logged?
+ @user = User.current
+ reply = JournalsForMessage.find params[:id].to_i
+ @syllabus = Syllabus.find reply.jour_id
+ if params[:reply_message].size>0 && User.current.logged? && @user
+ options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
+ feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
+ if (feedback.errors.empty?)
+ if params[:asset_id]
+ ids = params[:asset_id].split(',')
+ update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
+ end
+ @syllabus.update_column('updated_at', Time.now)
+ @count = @syllabus.journals_for_messages.count
+ @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
+ respond_to do |format|
+ format.js
+ end
+ else
+ flash[:error] = feedback.errors.full_messages[0]
+ end
+ end
+ else
+ render_403
+ end
+ end
def add_brief_introdution
user = User.current
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index e1dda3554..b3e946f95 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -274,14 +274,19 @@ module CoursesHelper
#searchPeopleByRoles(project, TeacherRoles)
members = []
project.members.includes(:user).each do |m|
- members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
+ #members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
+ members << m if m && m.user && m.user.has_teacher_role(project)
end
members
end
def TeacherAndAssistantCount course
- students_count = course.student.count
- number = course.members.count - students_count
+ #students_count = course.student.count
+ #number = course.members.count - students_count
+ member_ids = course.members.includes(:user).blank? ? "(-1)" : "(" + course.members.includes(:user).map { |mem| mem.id}.join(",") + ")"
+ role_ids = "(3, 7, 9)"
+ number = MemberRole.where("member_id in #{member_ids} and role_id in #{role_ids}").count
+ #number = (searchTeacherAndAssistant course).count
end
def search_student_in_group(project, course_group_id)
@@ -789,7 +794,7 @@ module CoursesHelper
if user.logged?
joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
- url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
+ url = joined ? join_path(:object_id => course.id) : join_private_courses_courses_path()
method = joined ? 'delete' : 'post'
if joined
link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
@@ -831,6 +836,10 @@ module CoursesHelper
result = l(:label_student)
elsif role == "Manager"
result = l(:field_admin)
+ elsif role.include?("TeachingAsistant") && role.include?("Student")
+ result = l(:label_TA) + " " + l(:label_student)
+ elsif role.include?("Teacher") && role.include?("Student")
+ result = l(:label_teacher) + " " + l(:label_student)
end
result
end
@@ -914,5 +923,15 @@ module CoursesHelper
resource_num*5 + journal_num + homework_journal_num ) desc limit 3;")
end
+ #用户在该课程是否具有某个角色
+ def get_user_member_roles_course course, user, role
+ members = course.members.where("user_id = #{user.id}")
+ result = false
+ unless members.blank?
+ m_roles = MemberRole.where("member_id = #{members.first.id} and role_id = #{role}")
+ end
+ result = !m_roles.blank?
+ result
+ end
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 98b993183..91743289a 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -54,6 +54,44 @@ module UsersHelper
end
end
+ # 获取消息角色
+ def applied_project_message_type role
+ case role
+ when 3
+ "管理员"
+ when 4
+ "开发人员"
+ when 5
+ "报告人员"
+ end
+ end
+
+ # 判断当前用户能否对消息进行操作
+ def allow_to_show applied_message
+ (User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false
+ end
+
+ # 项目申请消息通过状态判断用户
+ # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
+ def applied_project_users applied_message
+ # case applied_message.status
+ # when 3,2,1,5,4,7,6
+ user = User.find(applied_message.applied_user_id)
+ # end
+ end
+
+ # 项目申请消息通过状态判断tip描述
+ def applied_project_tip applied_message
+ case applied_message.status
+ when 4
+ "拒绝申请加入项目:"
+ when 5,3,2,1,7
+ "申请加入项目:"
+ when 6
+ "同意申请加入项目"
+ end
+ end
+
def get_resource_origin attach
type = attach.container_type
content = attach.container
@@ -690,4 +728,18 @@ module UsersHelper
end
result_ids
end
+
+ #课程的班级列表最近更新时间
+ def syllabus_course_list_sort syllabuses
+ syllabuses.each do |sy|
+ updated_at = sy.updated_at
+ courses = sy.courses.not_deleted
+ unless courses.empty?
+ course_ids = "(" + courses.map { |course| course.id}.join(",") + ")"
+ updated_at = CourseActivity.where("course_id in #{course_ids}").order("updated_at desc").first.updated_at
+ end
+ sy[:last_update] = updated_at
+ end
+ syllabuses
+ end
end
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 52f2ea119..d846071b5 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -364,22 +364,29 @@ module WatchersHelper
:class => "pr_join_a" ,:id=>id
end
- #申请加入项目
+ # 申请加入项目
def join_in_project_link(project, user, options=[])
- return '' unless user && user.logged?
applied = project.applied_projects.find_by_user_id(user.id)
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
- @applied_flag = project.instance_of?(Project)
+ url = applied_join_project_path(:object_id => project.id)
+ method = 'post'
+ @applied_flag = project.instance_of?(Project)
if applied
- appliedid = applied.id
+ link = "#{text} "
+ else
+ link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "pr_join_a")
end
- id = applied_css(project)
- url = appliedproject_path(
- :id=>appliedid,
- :user_id => user.id,
- :project_id => project.id)
- method = applied ? 'delete' : 'post'
- link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
+ link.html_safe
+ # if applied
+ # appliedid = applied.id
+ # end
+ # id = applied_css(project)
+ # url = appliedproject_path(
+ # :id=>appliedid,
+ # :user_id => user.id,
+ # :project_id => project.id)
+ # method = applied ? 'delete' : 'post'
+ # link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
end
def paginateHelper obj, pre_size=20
diff --git a/app/models/applied_message.rb b/app/models/applied_message.rb
index de07dae22..ee22f21c8 100644
--- a/app/models/applied_message.rb
+++ b/app/models/applied_message.rb
@@ -1,6 +1,6 @@
class AppliedMessage < ActiveRecord::Base
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
- attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :name
+ attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id
belongs_to :applied ,:polymorphic => true
belongs_to :apply_add_schools
belongs_to :user
diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb
index fb8bf90af..b1945a937 100644
--- a/app/models/applied_project.rb
+++ b/app/models/applied_project.rb
@@ -1,18 +1,16 @@
class AppliedProject < ActiveRecord::Base
- attr_accessible :project_id, :user_id
+ attr_accessible :project_id, :user_id, :role
belongs_to :user
belongs_to :project
- has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
+ has_many :applied_messages, :class_name => 'AppliedMessage', :as => :applied, :dependent => :destroy
after_create :send_appliled_message
+ # 仅仅给项目管理人员发送消息
def send_appliled_message
- # if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
- self.project.members.each do |m|
- if m.roles.first.to_s.include?("Manager")
- self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false)
- end
+ self.project.managers.each do |member|
+ self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id)
end
# end
end
diff --git a/app/models/member.rb b/app/models/member.rb
index 3cb70a8fe..cb15e067b 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -53,7 +53,15 @@ class Member < ActiveRecord::Base
new_role_ids = ids - role_ids
# Add new roles
- new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
+ if new_role_ids.include?(7) && new_role_ids.include?(10)
+ member_roles << MemberRole.new(:role_id => 7)
+ member_roles << MemberRole.new(:role_id => 10, :is_current => 0)
+ elsif new_role_ids.include?(9) && new_role_ids.include?(10)
+ member_roles << MemberRole.new(:role_id => 9)
+ member_roles << MemberRole.new(:role_id => 10, :is_current => 0)
+ else
+ new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
+ end
# Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
if member_roles_to_destroy.any?
diff --git a/app/models/member_role.rb b/app/models/member_role.rb
index 4d493cb27..799720833 100644
--- a/app/models/member_role.rb
+++ b/app/models/member_role.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MemberRole < ActiveRecord::Base
+ # multi_role 课程中的多重角色 0:单角色/学生,1:管理员&学生,2:教师&学生,3:教辅&学生
belongs_to :member
belongs_to :role
diff --git a/app/models/project.rb b/app/models/project.rb
index aa70084d2..67f010210 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -269,6 +269,11 @@ class Project < ActiveRecord::Base
notified.collect(&:mail)
end
+ # 返回为member类型数组
+ def managers
+ self.members.includes(:roles).select{|member| member.roles[0].try(:name) == "Manager"}
+ end
+
def initialize(attributes=nil, *args)
super
@@ -905,6 +910,24 @@ class Project < ActiveRecord::Base
User.find(self.user_id)
end
+ # 延迟生成邀请码
+ def invite_code
+ return generate_invite_code
+ end
+
+ # 生成邀请码
+ # 如果已有改邀请码,则重新生成
+ CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
+ def generate_invite_code
+ code = read_attribute(:invite_code)
+ if !code || code.size <6
+ code = CODES.sample(6).join
+ return generate_invite_code if Project.where(invite_code: code).present?
+ update_attribute(:invite_code, code)
+ end
+ code
+ end
+
private
def after_parent_changed(parent_was)
diff --git a/app/models/user.rb b/app/models/user.rb
index 996aa9be7..a4b7f3b25 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -42,12 +42,12 @@ class User < Principal
# Different ways of displaying/sorting users
USER_FORMATS = {
:firstname_lastname => {
- :string => '#{firstname} #{lastname}',
+ :string => '#{firstname}#{lastname}',
:order => %w(firstname lastname id),
:setting_order => 1
},
:firstname_lastinitial => {
- :string => '#{firstname} #{lastname.to_s.chars.first}.',
+ :string => '#{firstname}#{lastname.to_s.chars.first}.',
:order => %w(firstname lastname id),
:setting_order => 2
},
@@ -57,7 +57,7 @@ class User < Principal
:setting_order => 3
},
:lastname_firstname => {
- :string => '#{lastname} #{firstname}',
+ :string => '#{lastname}#{firstname}',
:order => %w(lastname firstname id),
:setting_order => 4
},
@@ -369,7 +369,8 @@ class User < Principal
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
- messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
+ applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
+ messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count
end
# 查询指派给我的缺陷记录
@@ -823,7 +824,7 @@ class User < Principal
# Find course membership
membership = coursemembership(course)
if membership
- roles = membership.roles
+ roles = membership.roles.where("is_current = 1")
else
@role_non_member ||= Role.non_member
roles << @role_non_member
@@ -918,6 +919,12 @@ class User < Principal
end
end
+ #是否具有老师角色
+ def has_teacher_role(course)
+ member = course.members.where("user_id = #{self.id}").first
+ role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)")
+ !role.blank?
+ end
# Return true if the user is allowed to do the specified action on a specific context
# Action can be:
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 811d73f55..ce3157d5f 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -391,6 +391,103 @@ class CoursesService
{:state => @state,:course => course}
end
+ #多个角色加入课程
+ def join_course_roles params,current_user
+ course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
+
+ @state = 10
+ if course
+ if course_endTime_timeout? course
+ @state = 2
+ elsif course[:is_delete] == 1
+ @state = 11
+ else
+ if current_user.member_of_course?(course) #如果已经是成员
+ @state = 3
+ # member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
+ # role_ids = params[:role]
+ # #roleName = member.roles[0].name if member
+ # #roleName = member.roles.map{|role| role.name}.join(",") if member
+ # if params[:invite_code].present?
+ # #如果加入角色为学生 并且当前是学生
+ # if role_ids == "10" && roleName.include?("Student") && !roleName.include?("Teacher") && !roleName.include?("TeachingAsistant")&& !roleName.include?("Manager")
+ # @state = 3
+ # #如果加入的角色为老师,并且当前已经是老师
+ # elsif role_ids == "9" && roleName.include?("Teacher") && !roleName.include?("Student")
+ # @state = 8
+ # #如果加入的角色教辅并且当前为教辅
+ # elsif role_ids == "7" && roleName.include?("TeachingAsistant") && !roleName.include?("Student")
+ # @state = 9
+ # elsif roleName.include?("Manager")
+ # @state = 10
+ # #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
+ # elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
+ # #如果已经发送过消息了,那么就要给个提示
+ # if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
+ # @state = 7
+ # else
+ # Mailer.run.join_course_request(course, User.current, params[:role])
+ # CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
+ # @state = 6
+ # end
+ # #如果加入角色是学生,但是是当前课程的教师或者教辅
+ # elsif params[:role] == "10" && roleName != "Student"
+ # member.role_ids = [params[:role]]
+ # member.save
+ # StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
+ # @state = 0
+ # end
+ # else
+ # @state = 1
+ # end
+ else
+ if params[:invite_code].present?
+ role_ids = params[:role]
+ role_str = role_ids.join(",")
+ if role_ids.include?("10") && !role_ids.include?("7") && !role_ids.include?("9")
+ members = []
+ members << Member.new(:role_ids => [10], :user_id => current_user.id)
+ course.members << members
+ StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
+ @state = 0
+ else
+ is_stu = false
+ if role_ids.include?("10")
+ members = []
+ members << Member.new(:role_ids => [10], :user_id => current_user.id)
+ course.members << members
+ StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id)
+ is_stu = true
+ end
+ #如果已经发送过消息了,那么就要给个提示
+ if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
+ if is_stu
+ @state = 12
+ else
+ @state = 7
+ end
+ else
+ Mailer.run.join_course_request(course, User.current, params[:role])
+ CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
+ if is_stu
+ @state = 13
+ else
+ @state = 6
+ end
+ end
+ end
+ else
+ @state = 1
+ end
+ end
+ end
+ else
+ @state = 4
+ end
+ {:state => @state,:course => course}
+ end
+
+
#作业列表
#已提交的作业数量获取 bid.homeworks.count
#学生提问数量获取 bid.commit.nil? ? 0 : bid.commit
diff --git a/app/views/admin/_courselist_detail_tr.html.erb b/app/views/admin/_courselist_detail_tr.html.erb
index 83b7904ce..6bec90845 100644
--- a/app/views/admin/_courselist_detail_tr.html.erb
+++ b/app/views/admin/_courselist_detail_tr.html.erb
@@ -7,7 +7,7 @@
- <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
+ <%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
<%= course.class_period %>
diff --git a/app/views/admin/non_syllabus_courses.html.erb b/app/views/admin/non_syllabus_courses.html.erb
index 1be979eeb..c5a2c81ec 100644
--- a/app/views/admin/non_syllabus_courses.html.erb
+++ b/app/views/admin/non_syllabus_courses.html.erb
@@ -72,7 +72,7 @@
- <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
+ <%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
<%= course.class_period %>
diff --git a/app/views/admin/syllabuses.html.erb b/app/views/admin/syllabuses.html.erb
index 194091abc..5098131da 100644
--- a/app/views/admin/syllabuses.html.erb
+++ b/app/views/admin/syllabuses.html.erb
@@ -52,7 +52,7 @@
- <%= link_to(syllabus.try(:user).try(:realname).truncate(6, omission: '...'), user_path(syllabus.user)) %>
+ <%= link_to syllabus.user.show_name, user_path(syllabus.user) %>
<%= format_date(syllabus.created_at) %>
@@ -70,7 +70,7 @@
<%= render :partial => 'admin/rename_course_name', :locals => {:course => course} %>
- <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
+ <%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
<%= format_date(course.created_at) %>
diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb
new file mode 100644
index 000000000..457cdf9cc
--- /dev/null
+++ b/app/views/applied_project/_applied_join_project.html.erb
@@ -0,0 +1,29 @@
+
+
diff --git a/app/views/applied_project/_applied_project_tip.js.erb b/app/views/applied_project/_applied_project_tip.js.erb
new file mode 100644
index 000000000..56e5270d6
--- /dev/null
+++ b/app/views/applied_project/_applied_project_tip.js.erb
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb
index ae9d3f467..5d9f7f87a 100644
--- a/app/views/applied_project/applied_join_project.js.erb
+++ b/app/views/applied_project/applied_join_project.js.erb
@@ -1,14 +1,3 @@
-// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败
-<% if @status == 0%>
- alert("<%= l('project.join.tips.notexist') %>");
-<% elsif @status == 1%>
- alert("<%= l('project.join.tips.repeat') %>");
-<% elsif @status == 2%>
- alert("<%= l('project.join.tips.success') %>");
- hideModal($("#popbox"));
- $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
-<% elsif @status == 3%>
- alert("<%= l('project.join.tips.has') %>");
-<%else%>
- alert("<%= l('project.join.tips.fail') %>");
-<%end%>
\ No newline at end of file
+var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => (@project.nil? ? nil : @project.id)}) %>";
+pop_box_new(htmlvalue,460,40,50);
+
diff --git a/app/views/applied_project/applied_project_info.js.erb b/app/views/applied_project/applied_project_info.js.erb
new file mode 100644
index 000000000..ab3cb396d
--- /dev/null
+++ b/app/views/applied_project/applied_project_info.js.erb
@@ -0,0 +1,5 @@
+<% if @project %>
+$("#join_in_project_applied").html('<%= escape_javascript( render :partial => 'projects/applied_status') %>');
+<% end %>
+var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>";
+pop_box_new(htmlvalue,380,40,50);
diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb
index 0f7e8a012..759a9a735 100644
--- a/app/views/attachments/_project_file_links.html.erb
+++ b/app/views/attachments/_project_file_links.html.erb
@@ -92,7 +92,7 @@
<% end %>
<% if options[:author] %>
- <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
+ <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
<%= format_time(attachment.created_on) %>
<% end %>
diff --git a/app/views/blog_comments/destroy.js.erb b/app/views/blog_comments/destroy.js.erb
index c34986977..52ecbb925 100644
--- a/app/views/blog_comments/destroy.js.erb
+++ b/app/views/blog_comments/destroy.js.erb
@@ -1,5 +1,5 @@
<% if @in_user_homepage %>
- <% homepage = BlogComment.find(User.current.blog.homepage_id) %>
+ <% homepage = BlogComment.find(@user.blog.homepage_id) %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>");
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb
index a16547836..a076ed15c 100644
--- a/app/views/blogs/_homepage.html.erb
+++ b/app/views/blogs/_homepage.html.erb
@@ -1,6 +1,5 @@
-
<% if activity.author.id == User.current.id%>
<%end%>
-
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id,
:blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey", :style => 'text-align:center;' %>
@@ -45,7 +43,6 @@
-
<% all_comments = []%>
@@ -57,7 +54,7 @@
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
- <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
+ <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
<% end %>
diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb
index 55217017b..9f45172bc 100644
--- a/app/views/courses/_copy_course.html.erb
+++ b/app/views/courses/_copy_course.html.erb
@@ -114,7 +114,7 @@
资源
-
复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生可能看不到资源。
+
复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生将看不到资源。
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb
index ec5d18c7e..f95129903 100644
--- a/app/views/courses/_join_private_course.html.erb
+++ b/app/views/courses/_join_private_course.html.erb
@@ -1,100 +1,52 @@
-
-
-
-
-
快速进入班级通道
-
-
-
+
+
+
+
+ 确 定
+ 取 消
-
-
-
-
-
快速加入班级通道
-
只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!
-
-
-
+
+
+
+ <% end %>
+
-
-
-
+
\ No newline at end of file
diff --git a/app/views/courses/_member.html.erb b/app/views/courses/_member.html.erb
index 95177c92c..9e6abcf4f 100644
--- a/app/views/courses/_member.html.erb
+++ b/app/views/courses/_member.html.erb
@@ -10,7 +10,7 @@
) do |f| %>
<% @roles.each do |role| %>
- <%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
+ <%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), :id => "edit_member_role_#{member.id}_#{role.id}",
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<%= zh_course_role(h role) %>
@@ -35,4 +35,25 @@
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
<% end%>
-<% end%>
\ No newline at end of file
+
+
+<% end%>
diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb
index c41edf680..5f9e512d7 100644
--- a/app/views/courses/_tool_expand.html.erb
+++ b/app/views/courses/_tool_expand.html.erb
@@ -29,7 +29,7 @@
<% if show_nav?(course_feedback_count) %>
留言
- <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
+ <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
<% end %>
<% if show_nav?(course_poll_count) %>
diff --git a/app/views/courses/join.js.erb b/app/views/courses/join.js.erb
index ac8b717d1..52c1347a5 100644
--- a/app/views/courses/join.js.erb
+++ b/app/views/courses/join.js.erb
@@ -36,6 +36,10 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co
alert("您已经是该班级的管理员了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 11%>
+alert("该班级已被删除");
+hidden_join_course_form();
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% else %>
alert("未知错误,请稍后再试");
<% end %>
diff --git a/app/views/courses/join_course_multi_role.js.erb b/app/views/courses/join_course_multi_role.js.erb
new file mode 100644
index 000000000..97d6b33ce
--- /dev/null
+++ b/app/views/courses/join_course_multi_role.js.erb
@@ -0,0 +1,52 @@
+<% if @object_id && @state != 6 && @state !=4 %>
+$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
+<% end %>
+<% if @state %>
+<% if @state == 0 %>
+alert("加入成功");
+hideModal();
+$("#try_join_course_link").replaceWith(" 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品 ");
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 1 %>
+alert("密码错误");
+<% elsif @state == 2 %>
+alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
+<% elsif @state == 3 %>
+alert("您已经加入了班级");
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 4 %>
+alert("您加入的班级不存在");
+<% elsif @state == 5 %>
+alert("您还未登录");
+<% elsif @state == 6 %>
+alert("申请成功,请等待审核");
+hidden_join_course_form();
+<% elsif @state == 7%>
+alert("您已经发送过申请了,请耐心等待");
+hidden_join_course_form();
+<% elsif @state == 8%>
+alert("您已经是该班级的教师了");
+hidden_join_course_form();
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 9%>
+alert("您已经是该班级的教辅了");
+hidden_join_course_form();
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 10%>
+alert("您已经是该班级的管理员了");
+hidden_join_course_form();
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 11%>
+alert("该班级已被删除");
+hidden_join_course_form();
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 12 %>
+alert("您已经发送过申请了,请耐心等待");
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% elsif @state == 13 %>
+alert("申请成功,请等待审核");
+window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
+<% else %>
+alert("未知错误,请稍后再试");
+<% end %>
+<% end %>
diff --git a/app/views/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb
index 199cfb5ae..14402a9ff 100644
--- a/app/views/courses/join_private_courses.js.erb
+++ b/app/views/courses/join_private_courses.js.erb
@@ -1,11 +1,2 @@
-$('#topnav_course_menu').hide();
-$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
-showModal('ajax-modal', '540px');
-$('#ajax-modal').css('height','390px');
-//$('#ajax-modal').siblings().remove();
-$('#ajax-modal').siblings().hide();
-$('#ajax-modal').before("" +
- " ");
-$('#ajax-modal').parent().removeClass("alert_praise");
-$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
-$('#ajax-modal').parent().addClass("alert_box");
+var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>";
+pop_box_new(htmlvalue,460,40,50);
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index fe6b3e596..f53c8c716 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -17,13 +17,13 @@
* <%= l(:label_tags_course_name)%> :
-
+
班级名称不能为空且至少有两个字符
* <%= l(:label_class_period)%> :
-
+
diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb
index ec9a0bc54..ac912a71c 100644
--- a/app/views/issues/_detail.html.erb
+++ b/app/views/issues/_detail.html.erb
@@ -20,7 +20,7 @@
<%= get_issue_priority(@issue.priority_id)[1] %>
- 由<%= @issue.author %> 添加于 <%= format_time(@issue.created_on).html_safe %>
+ 由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
diff --git a/app/views/layouts/_base_course_old.html.erb b/app/views/layouts/_base_course_old.html.erb
deleted file mode 100644
index 4b2077cf8..000000000
--- a/app/views/layouts/_base_course_old.html.erb
+++ /dev/null
@@ -1,278 +0,0 @@
-<%# course_model %>
-<% course_file_num = visable_attachemnts_incourse(@course).count%>
-<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
-<% homework_num = visable_course_homework @course %>
-
-
-
-
-
-
- <%= h html_title %>
-
-
-
- <%= csrf_meta_tag %>
- <%= favicon %>
- <%= javascript_heads %>
- <%= heads_for_theme %>
- <%= call_hook :view_layouts_base_html_head %>
- <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%>
- <%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %>
-
- <%= yield :header_tags -%>
-
-
-
-
-
-
-
-
-
-
-
- <% if User.current.logged? %>
- <%= render :partial => 'layouts/logined_header' %>
- <% else%>
- <%= render :partial => 'layouts/unlogin_header' %>
- <% end%>
-
-
-
-
-
-
- <%=render :partial=>'layouts/project_info' %>
-
-
-
-
- <%= l(:label_main_teacher)%> : <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %>
- <%= l(:label_class_period)%> : <%= @course.class_period %> <%= l(:label_class_hour) %>
- <%= l(:label_main_term)%> : <%= current_time_and_term @course %>
- <% if @course.school%>
- <%= l(:label_course_organizers)%> : <%= @course.school%>
- <% end%>
-
-
-
- <%# 更新访问数,刷新的时候更新访问次数 %>
- <% update_visiti_count @course %>
- <%# over %>
-
-
- <% unless show_nav?(@course.course_activities.count) %>
-
- <%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
-
- <%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
-
- <% end %>
- <% unless show_nav?(@course.homework_commons.count) %>
-
- <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
- <%= link_to "(#{homework_num})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
- <%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
-
- <% end %>
- <% unless show_nav?(@course.news.count) %>
-
- <%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
- <%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
- <%= link_to( "", new_course_news_path(@course,:is_new=>1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
-
- <% end %>
- <% unless show_nav?(course_file_num) %>
-
- <%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
- <%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
- <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
-
-
- <% end %>
-
- <% end %>
- <% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
-
- <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
- <%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
- <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
-
- <% end %>
- <% unless show_nav?(course_feedback_count) %>
-
- <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
- <%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
- <%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
-
- <% end %>
- <% unless show_nav?(course_poll_count) %>
-
- <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>
- <%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
- <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
-
- <% end %>
- <% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count) %>
-
- <%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
- <%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
- <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
-
- <% end %>
- <%# 工具栏展开 %>
- <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
- course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
-
-
<%= l(:label_project_more) %>
-
- <%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>
-
- <% end %>
-
- <%# 课程活跃度 %>
-
- <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
- <%# 课程英雄榜 %>
- <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
-
- <% if @course.description && !@course.description.blank? %>
-
-
-
<%= l(:label_course_brief_introduction)%>:
-
- <%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
-
-
-
-
- <% end %>
-
-
<%= l(:label_tag)%>:
-
- <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
-
-
-
-
- <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
-
访问计数 <%= @course.visits.to_i %> (自2016年5月)
-
-
-
- <%= yield %>
- <%#= render_flash_messages %>
- <%#= call_hook :view_layouts_base_content %>
-
-
-
-
-
-
-
-
-<%= render :partial => 'layouts/footer' %>
-
-
-<%= render :partial => 'layouts/new_feedback' %>
-
- <%= l(:label_loading) %>
-
-
-<%= call_hook :view_layouts_base_body_bottom %>
-
-
-
-
\ No newline at end of file
diff --git a/app/views/layouts/_base_syllabus_old.html.erb b/app/views/layouts/_base_syllabus_old.html.erb
deleted file mode 100644
index 45e77dbad..000000000
--- a/app/views/layouts/_base_syllabus_old.html.erb
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
- <%= h html_title %>
-
-
- <%= csrf_meta_tag %>
- <%= favicon %>
- <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','css/common','css/public','css/structure','css/courses','css/popup','prettify',:media => 'all' %>
- <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
- <%= javascript_heads %>
- <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%>
- <%= heads_for_theme %>
- <%= call_hook :view_layouts_base_html_head %>
- <%= yield :header_tags -%>
-
-
-
-
-
-
-
-<% is_current_user = User.current.logged?%>
-
- <% if User.current.logged? %>
- <%= render :partial => 'layouts/logined_header' %>
- <% else%>
- <%= render :partial => 'layouts/unlogin_header' %>
- <% end%>
-
-
-
-
-
-
- <%=render :partial => 'layouts/syllabus_info' %>
-
- <% update_visiti_count @syllabus %>
-
-
-
-
-
-
-
标签:
-
- <%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%>
-
-
-
-
访问计数 <%=@syllabus.visits %> (自2016年7月)
-
-
-
-
- <%= render :partial => 'layouts/new_feedback' %>
-
-
-<%= render :partial => 'layouts/footer' %>
-
-
-
-
- <%= l(:label_loading) %>
-
-
-
-
diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb
index 546b27421..1c01ecf53 100644
--- a/app/views/layouts/_course_base_info.html.erb
+++ b/app/views/layouts/_course_base_info.html.erb
@@ -11,16 +11,13 @@
<% if is_teacher %>
-
+
-
-
- <%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %>
- <%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %>
- <%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %>
- <% if @course.syllabus %>
- <%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %>
- <% end %>
+
+
+ <%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %>
+ <%= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %>
+ <%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %>
@@ -45,7 +42,7 @@
<%=@course.name %>
-
<%=@course.is_public == 0 ? '私有' : '公开' %>
+
教师:<%= course_teacher_link teacher_num %>
学生:<%= course_student_link student_num %>
@@ -59,8 +56,18 @@
学期:<%= current_time_and_term @course %>
单位:<%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %>
-
- <% unless is_teacher %>
+ <% if is_teacher %>
+ <%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %>
+ <% end %>
+ <% is_TA = get_user_member_roles_course @course, User.current, 7 %>
+ <% is_TE = get_user_member_roles_course @course, User.current, 9 %>
+ <% is_ST = get_user_member_roles_course @course, User.current, 10 %>
+ <% if !is_teacher && (is_TA || is_TE) %>
+ <%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %>
+ <% elsif is_teacher && is_ST %>
+ <%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %>
+ <% end %>
+ <% unless (is_teacher || is_TA || is_TE) %>
<% end %>
diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb
index 35d8f87ef..7d2f1b4d2 100644
--- a/app/views/layouts/_join_exit_project.html.erb
+++ b/app/views/layouts/_join_exit_project.html.erb
@@ -1,12 +1,8 @@
- <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
-
<%= watcher_link_for_project(@project, User.current) %>
- <% end %>
-
- <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
- <%= join_in_project_link(@project, User.current) %>
- <% end %>
+
+ <%= render :partial => "projects/applied_status" %>
+
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
<%= link_to "
#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 7a9f5ac5e..2972045aa 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -91,8 +91,8 @@
<% end %>
<% unless show_nav?(course_feedback_count) %>
- 留言<%=course_feedback_count %>
- <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
+ 留言<%=course_feedback_count %>
+ <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
<% end %>
<% unless show_nav?(course_poll_count) %>
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb
index a19295233..e7b23b3b5 100644
--- a/app/views/layouts/base_projects.html.erb
+++ b/app/views/layouts/base_projects.html.erb
@@ -53,7 +53,8 @@
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
- <%= l(:label_project_id)%><%= @project.id %>
+ <%= l(:label_project_ivite_code)%>
+ <%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index f280f6506..0c49cc3b2 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -192,7 +192,7 @@
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %>
<% if is_current_user%>
- <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
+ <%# if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
- <% else%>
- <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
- <% end%>
+ <%# else%>
+ <%#=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
+ <%# end%>
<% end%>
<% end %>
@@ -245,8 +245,21 @@
<%# if @user.projects.visible.count > 0
@@ -362,6 +375,12 @@
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
+ $("#projectMenu").mouseenter(function(){
+ $("#topnav_project_menu").show();
+ });
+ $("#projectMenu").mouseleave(function(){
+ $("#topnav_project_menu").hide();
+ });
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
diff --git a/app/views/members/allow_to_join_project.js.erb b/app/views/members/allow_to_join_project.js.erb
new file mode 100644
index 000000000..cbd37e188
--- /dev/null
+++ b/app/views/members/allow_to_join_project.js.erb
@@ -0,0 +1,5 @@
+<% if @flash_message %>
+ alert("<%= @flash_message %>");
+<% else%>
+ $("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
+<% end%>
diff --git a/app/views/members/refused_allow_to_join_project.js.erb b/app/views/members/refused_allow_to_join_project.js.erb
new file mode 100644
index 000000000..109ed3a62
--- /dev/null
+++ b/app/views/members/refused_allow_to_join_project.js.erb
@@ -0,0 +1 @@
+$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
\ No newline at end of file
diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb
new file mode 100644
index 000000000..d29819c03
--- /dev/null
+++ b/app/views/projects/_applied_status.html.erb
@@ -0,0 +1,9 @@
+<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
+ <%= watcher_link_for_project(@project, User.current) %>
+
+ <% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
+ <%= join_in_project_link(@project, User.current) %>
+ <% else %>
+ 等待审批
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb
index 6961fcbac..2c7d36fb5 100644
--- a/app/views/projects/_development_group.html.erb
+++ b/app/views/projects/_development_group.html.erb
@@ -55,12 +55,6 @@
<%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
<% end %>
-
- <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
-
- <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "f14 c_blue02" %>
-
- <% end %>
<% end %>
<%= l(:label_project_more) %>
diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb
index b73ef647f..0773f7732 100644
--- a/app/views/projects/settings/_new_members.html.erb
+++ b/app/views/projects/settings/_new_members.html.erb
@@ -92,32 +92,6 @@
<% if roles.any? %>
- <% if @project.applied_projects.any? %>
-
-
<%= l(:label_apply_project) %>
- <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
-
- <%= render_principals_for_applied_members_new(@project) %>
-
-
- <%= l(:label_role_plural) %>:
- <% roles.each do |role| %>
-
- <%= check_box_tag 'membership[role_ids][]', role.id %>
- <%= h role %>
-
- <% end %>
-
-
- <%= l(:label_approve) %>
-
-
- <%= l(:label_refusal) %>
-
- <% end %>
-
-
- <% end %>
<%= l(:label_member_new) %>
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index 823d0c1ad..b80d9ee5b 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -7,6 +7,10 @@
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
<% end %>
+
+ <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
+ <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %>
+ <% end %>
<% if @entries.nil? %>
diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb
index cdb566412..4384ba2ee 100644
--- a/app/views/syllabuses/_syllabus_course_list.html.erb
+++ b/app/views/syllabuses/_syllabus_course_list.html.erb
@@ -24,7 +24,7 @@
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "sy_classlist_title fl",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
<% end %>
-
<%=course.is_public? ? '公开' : '私有' %>
+
主讲老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %>
diff --git a/app/views/syllabuses/new.html.erb b/app/views/syllabuses/new.html.erb
index 3c0a39bf1..ced8a3d66 100644
--- a/app/views/syllabuses/new.html.erb
+++ b/app/views/syllabuses/new.html.erb
@@ -6,13 +6,13 @@
<%= labelled_form_for @syllabus do |f| %>
* 课程名称 :
-
+
课程名称不能为空且至少有两个字符
* <%= l(:label_tags_course_eng_name)%> :
-
+
diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb
index 9b1bdafc5..e39d538ce 100644
--- a/app/views/syllabuses/show.html.erb
+++ b/app/views/syllabuses/show.html.erb
@@ -53,7 +53,7 @@
<% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
- <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
+ <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus', :activity_id => @syllabus.id} %>
<% end %>
diff --git a/app/views/users/_all_replies.html.erb b/app/views/users/_all_replies.html.erb
deleted file mode 100644
index a74acc77c..000000000
--- a/app/views/users/_all_replies.html.erb
+++ /dev/null
@@ -1,39 +0,0 @@
-
- <% comments.each do |comment| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
-
-
-
- <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
- <%= time_from_now(comment.created_time) %>
-
-
- <% if !comment.content_detail.blank? || comment.class == Journal %>
-
- <% end %>
-
-
-
- <% end %>
-
\ No newline at end of file
diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb
new file mode 100644
index 000000000..1abe77b81
--- /dev/null
+++ b/app/views/users/_courses_list.html.erb
@@ -0,0 +1,30 @@
+<% unless courses.nil? %>
+ <% courses.each_with_index do |course, i| %>
+
+ <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %>
+ " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>">
+
+
+
+
<%=course.name %>
+
+
主讲老师:<%=course.teacher.show_name %>
+
+
+
+
更新:<%=format_date Time.at(course.updatetime) %> 学期:<%=current_time_and_term(course) %>
+
<%=studentCount course %> 学生 | <%=visable_course_homework course %> 作业 | <%=visable_attachemnts_incourse(@course).count %> 资源
+
+
+
+
+
+
+
+ <% end %>
+ <% if courses.count > 3 %>
+
+ 共<%=courses.count %>个班级,点击全部展开
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb
index 933de0b0d..cb9399dba 100644
--- a/app/views/users/_join_course_course_message.html.erb
+++ b/app/views/users/_join_course_course_message.html.erb
@@ -5,7 +5,7 @@
- <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
+ <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@@ -18,14 +18,14 @@
真实姓名:<%= User.find(ma.course_message_id).realname %>
申请课程:<%= Course.find(ma.course_id).name%>
课程描述:
- <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
+ <%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %>
申请职位:<%= ma.content.include?('9') ? "教师" : "教辅"%>
<% if ma.status == 0 || ma.status.nil?%>
- <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
+ <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
|
- <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
+ <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
<% elsif ma.status == 1%>
您已经同意了该申请
<% elsif ma.status == 2%>
diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb
index 9ef2d146d..994c5c64e 100644
--- a/app/views/users/_message_replies.html.erb
+++ b/app/views/users/_message_replies.html.erb
@@ -82,7 +82,7 @@
<%= link_to(
l(:button_reply),
- {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage},
+ {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage, :user_id => user_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !comment.root.locked? %>
@@ -91,7 +91,7 @@
<% if comment.author == User.current %>
<%= link_to(
l(:button_delete),
- {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage},
+ {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage, :user_id => user_id},
:method => :delete,
:remote => true,
:class => 'fr mr20',
diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb
index a4732af8c..1da4bc85e 100644
--- a/app/views/users/_news_replies.html.erb
+++ b/app/views/users/_news_replies.html.erb
@@ -76,6 +76,20 @@
:class => 'fr mr20',
:title => l(:button_delete)
) if comment.user_id == User.current.id %>
+ <% elsif type == 'Syllabus' %>
+
+ <%= link_to(
+ l(:button_reply),
+ {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type},
+ :remote => true,
+ :method => 'get',
+ :title => l(:button_reply)) %>
+
+
+ <% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%>
+ <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user},
+ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
+ <% end %>
<% end %>
diff --git a/app/views/users/_reply_banner.html.erb b/app/views/users/_reply_banner.html.erb
index 43aebb89c..4f2094899 100644
--- a/app/views/users/_reply_banner.html.erb
+++ b/app/views/users/_reply_banner.html.erb
@@ -1,4 +1,4 @@
-
+
回复
︿
diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb
index aa519a5da..8752de30b 100644
--- a/app/views/users/_reply_to.html.erb
+++ b/app/views/users/_reply_to.html.erb
@@ -42,7 +42,7 @@
<% end%>
<% elsif @type == 'BlogComment' %>
- <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :remote => true) do |f| %>
+ <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => @user_id}, :method => "post", :remote => true) do |f| %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
@@ -82,6 +82,15 @@
<% end %>
+ <% elsif @type == 'Syllabus' %>
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_syllabus', :id => reply.id},:method => "post", :remote => true) do |f| %>
+
+
+
+
发送
+
+
+ <% end%>
<% end %>
diff --git a/app/views/users/_syllabus_course_list.html.erb b/app/views/users/_syllabus_course_list.html.erb
new file mode 100644
index 000000000..993192978
--- /dev/null
+++ b/app/views/users/_syllabus_course_list.html.erb
@@ -0,0 +1,61 @@
+
+ <% if @type.to_i == 2 %>
+ <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
+ <% else %>
+ <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
+ <% end %>
+ <%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %>
+ <% if @type.to_i == 1 %>
+ <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
+ <% else %>
+ <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %>
+ <% end %>
+ <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %>
+
<%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程
+
+
+
+<% if syllabuses.any? %>
+ <% syllabuses.each_with_index do |syllabus, index|%>
+
+ <% course_count = syllabus.courses.not_deleted.count %>
+
+
+
+
<%=syllabus.title %>
+
+
更新时间:<%=format_date syllabus.updated_at %>
+ 创建老师:<%=syllabus.user.show_name %>
+ 班级:<%=course_count %>
+
+
+
+
+
+
+ <% if index == 0 %>
+ <% courses = syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %>
+ <%= render :partial => 'users/courses_list', :locals => {:courses => courses, :syllabus => syllabus}%>
+ <% end %>
+
+
+
+
+
+
+
+
+ <%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
+
+ <% if User.current == syllabus.user %>
+ <%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%>
+ <% end %>
+
+
+
+
+
+ <% end %>
+<% else %>
+
<%= l(:label_no_data) %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb
index b6cd9ebc3..5361a37ad 100644
--- a/app/views/users/_user_blog.html.erb
+++ b/app/views/users/_user_blog.html.erb
@@ -50,7 +50,7 @@
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
- <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%>
+ <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0, :user_id => activity.author_id}%>
<% end %>
diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb
index 669e7aa91..6051d8de9 100644
--- a/app/views/users/_user_homework_attachment.html.erb
+++ b/app/views/users/_user_homework_attachment.html.erb
@@ -70,7 +70,7 @@
上传附件
- <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作品的附件", :remote => true %>
+ <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %>
<% if defined?(has_program) && has_program %>
编程
diff --git a/app/views/users/_user_join_syllabus_list.html.erb b/app/views/users/_user_join_syllabus_list.html.erb
new file mode 100644
index 000000000..7faab0017
--- /dev/null
+++ b/app/views/users/_user_join_syllabus_list.html.erb
@@ -0,0 +1,3 @@
+
+ <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @join_syllabuses, :list_type => 2} %>
+
diff --git a/app/views/users/_user_message_applide_action.html.erb b/app/views/users/_user_message_applide_action.html.erb
new file mode 100644
index 000000000..fc56b9f22
--- /dev/null
+++ b/app/views/users/_user_message_applide_action.html.erb
@@ -0,0 +1,12 @@
+<% if allow_to_show(ma) %>
+ :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> |
+ <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %>
+<% elsif ma.status == 4 %>
+
被拒绝
+<% elsif ma.status == 5 %>
+
您已拒绝
+<% elsif ma.status == 6 %>
+
已通过
+<% elsif ma.status == 7 %>
+
您已同意
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_applide_users.html.erb b/app/views/users/_user_message_applide_users.html.erb
new file mode 100644
index 000000000..18539c628
--- /dev/null
+++ b/app/views/users/_user_message_applide_users.html.erb
@@ -0,0 +1,2 @@
+<%=link_to applied_project_users(ma), user_path(applied_project_users(ma)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
+
<%= applied_project_tip(ma) %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb
index 0a4924c27..6befe300e 100644
--- a/app/views/users/_user_message_applied.html.erb
+++ b/app/views/users/_user_message_applied.html.erb
@@ -30,5 +30,26 @@
<% end %>
+ <% elsif ma && ma.applied_type == "AppliedProject" %>
+
+
+ <%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %>
+
+
+ <%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
+
+
+ 以“<%= applied_project_message_type(ma.role) %>”身份加入
+ <% project = Project.find(ma.project_id) %>
+ <%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
+
+
+
+
+ <%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
<% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index fa2be7ae1..98ed3d1dc 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -586,9 +586,9 @@
<%= link_to ma.status == 1 ?
- '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过'
+ '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过'
:
- '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
+ '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb
index 9fa93c76e..b6c767771 100644
--- a/app/views/users/_user_syllabus_list.html.erb
+++ b/app/views/users/_user_syllabus_list.html.erb
@@ -1,132 +1,3 @@
-
-
课程列表
-
-
排序:
- <%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %>
- <% if @type.to_i == 1 %>
- <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
- <% else %>
- <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %>
- <% end %>
- <%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %>
- <% if @type.to_i == 2 %>
- <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
- <% else %>
- <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %>
- <% end %>
-
-
-
- <% if @syllabus.any? %>
- <% @syllabus.each_with_index do |syllabus, index|%>
-
- <% courses = @courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc") %>
-
-
-
-
<%=syllabus.title %>
-
-
更新时间:<%=format_date syllabus.updated_at %>
- 创建老师:<%=syllabus.user.show_name %>
- 班级:<%=courses.count %>
-
-
-
-
-
-
-
-
-
-
-
- <%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
-
- <% if User.current == syllabus.user %>
- <%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%>
- <% end %>
-
-
-
-
-
- <% end %>
-
-
- <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
-
-
-
- <% else %>
-
<%= l(:label_no_data) %>
- <% end %>
-
-
-
\ No newline at end of file
+
+ <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @my_syllabuses, :list_type => 1} %>
+
\ No newline at end of file
diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb
index cc36ef3b3..a5fca2a60 100644
--- a/app/views/users/all_journals.js.erb
+++ b/app/views/users/all_journals.js.erb
@@ -5,11 +5,9 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part
<% elsif params[:type] == 'Message' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>');
<% elsif params[:type] == 'BlogComment' %>
-$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>');
+$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage, :user_id => @user_id}) %>');
<% elsif params[:type] == 'OrgDocumentComment' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
-<% elsif params[:type] == 'News' || params[:type] == 'Issue' %>
+<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
-<% else %>
-$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
<% end %>
diff --git a/app/views/users/expand_courses.js.erb b/app/views/users/expand_courses.js.erb
new file mode 100644
index 000000000..3b2291e1d
--- /dev/null
+++ b/app/views/users/expand_courses.js.erb
@@ -0,0 +1,5 @@
+<% unless @courses.empty? %>
+ $("#syllabus_course_ul_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/courses_list', :locals => {:courses => @courses, :syllabus => @syllabus}) %>");
+ $("#syllabus_course_ul_<%=@syllabus.id %>").parent().show();
+ $("#syllabus_course_ul_<%=@syllabus.id %>").parent().prev().children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open");
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/sort_syllabus_list.js.erb b/app/views/users/sort_syllabus_list.js.erb
new file mode 100644
index 000000000..e353109f4
--- /dev/null
+++ b/app/views/users/sort_syllabus_list.js.erb
@@ -0,0 +1,5 @@
+<% if @list_type.to_i == 1 %>
+$("#user_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 1}) %>');
+<% else %>
+$("#user_join_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 2}) %>');
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/user_courselist.html.erb b/app/views/users/user_courselist.html.erb
index 148cc1703..25bf2354d 100644
--- a/app/views/users/user_courselist.html.erb
+++ b/app/views/users/user_courselist.html.erb
@@ -1 +1,35 @@
-<%= render :partial => 'users/user_syllabus_list'%>
+
+
课程列表
+
+ <%= render :partial => 'users/user_syllabus_list'%>
+
+ <%= render :partial => 'users/user_join_syllabus_list'%>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb
index c527474cd..00be899cc 100644
--- a/app/views/words/destroy.js.erb
+++ b/app/views/words/destroy.js.erb
@@ -1,6 +1,6 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
-<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
+<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
<% if @activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
@@ -18,12 +18,15 @@
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
+ <% elsif @syllabus %>
+ $("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
+ $("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>");
<% elsif @course && @jours_count%>
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% else %>
- $('#course_jour_count').html("(<%= @jours_count %>)");
+ $('#course_jour_count').html("<%= @jours_count %>");
<% end %>
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
diff --git a/app/views/words/reply_to_syllabus.js.erb b/app/views/words/reply_to_syllabus.js.erb
new file mode 100644
index 000000000..4bc4848ad
--- /dev/null
+++ b/app/views/words/reply_to_syllabus.js.erb
@@ -0,0 +1,2 @@
+$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
+$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :activity_id => @syllabus.id}) %>");
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml
index 076b905c3..91cc96791 100644
--- a/config/locales/projects/zh.yml
+++ b/config/locales/projects/zh.yml
@@ -48,6 +48,7 @@ zh:
# 左边栏
#
label_project_id: "项目ID:"
+ label_project_ivite_code: "邀请码:"
label_agree_join_project: 同意加入
label_apply_project: "+申请加入"
@@ -55,7 +56,7 @@ zh:
label_exit_project: 退出项目
label_apply_project_waiting: 已处理申请,请等待管理员审核
label_member_of_project: 该用户已经是项目成员了!
- label_unapply_project: 取消申请
+ label_unapply_project: 等待审批
lable_sure_exit_project: 是否确认退出该项目
label_friend_organization: 圈子模式
label_research_group: 研讨模式
diff --git a/config/routes.rb b/config/routes.rb
index b07600400..61425ddaf 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -563,6 +563,7 @@ RedmineApp::Application.routes.draw do
post "user_commit_homework"
post 'user_select_homework'
get 'all_journals'
+ get 'expand_courses'
end
member do
@@ -619,6 +620,8 @@ RedmineApp::Application.routes.draw do
match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist"
match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist"
+ match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list"
+
get 'edit_brief_introduction'
get "user_resource"
get "import_resources"
@@ -721,8 +724,9 @@ RedmineApp::Application.routes.draw do
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
- post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject'
- delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project'
+ post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project'
+ post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info'
+ delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project'
resources :projects do
member do
@@ -766,6 +770,8 @@ RedmineApp::Application.routes.draw do
collection do
get 'autocomplete'
get 'appliedproject'
+ post 'allow_to_join_project'
+ get 'refused_allow_to_join_project'
end
end
@@ -1156,9 +1162,12 @@ RedmineApp::Application.routes.draw do
get "homework_search"
get "show_comparecode"
get "statistics_course"
+ get "switch_role"
end
collection do
match 'join_private_courses', :via => [:get, :post]
+ post "join_course_multi_role"
+
end
match '/member', :to => 'courses#member', :as => 'member', :via => :get
@@ -1240,6 +1249,7 @@ RedmineApp::Application.routes.draw do
post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message"
post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message"
post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework"
+ post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus"
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'
diff --git a/db/migrate/20160725062343_add_invite_code_to_project.rb b/db/migrate/20160725062343_add_invite_code_to_project.rb
new file mode 100644
index 000000000..5eb8beace
--- /dev/null
+++ b/db/migrate/20160725062343_add_invite_code_to_project.rb
@@ -0,0 +1,5 @@
+class AddInviteCodeToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :invite_code, :string
+ end
+end
diff --git a/db/migrate/20160727065357_add_column_to_member_role.rb b/db/migrate/20160727065357_add_column_to_member_role.rb
new file mode 100644
index 000000000..861a32e27
--- /dev/null
+++ b/db/migrate/20160727065357_add_column_to_member_role.rb
@@ -0,0 +1,5 @@
+class AddColumnToMemberRole < ActiveRecord::Migration
+ def change
+ add_column :member_roles, :is_current, :integer, :default => 1
+ end
+end
diff --git a/db/migrate/20160728041943_add_qrcode_to_project.rb b/db/migrate/20160728041943_add_qrcode_to_project.rb
new file mode 100644
index 000000000..fea91e225
--- /dev/null
+++ b/db/migrate/20160728041943_add_qrcode_to_project.rb
@@ -0,0 +1,5 @@
+class AddQrcodeToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :qrcode, :string
+ end
+end
diff --git a/db/migrate/20160728075947_add_role_to_applied_project.rb b/db/migrate/20160728075947_add_role_to_applied_project.rb
new file mode 100644
index 000000000..964af6f19
--- /dev/null
+++ b/db/migrate/20160728075947_add_role_to_applied_project.rb
@@ -0,0 +1,5 @@
+class AddRoleToAppliedProject < ActiveRecord::Migration
+ def change
+ add_column :applied_projects, :role, :integer, :default => 0
+ end
+end
diff --git a/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb b/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb
new file mode 100644
index 000000000..480123b05
--- /dev/null
+++ b/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb
@@ -0,0 +1,5 @@
+class AddAppliedUserIdToAppliedMessage < ActiveRecord::Migration
+ def change
+ add_column :applied_messages, :applied_user_id, :integer
+ end
+end
diff --git a/db/migrate/20160729124038_add_role_to_applied_message.rb b/db/migrate/20160729124038_add_role_to_applied_message.rb
new file mode 100644
index 000000000..c6a73c794
--- /dev/null
+++ b/db/migrate/20160729124038_add_role_to_applied_message.rb
@@ -0,0 +1,5 @@
+class AddRoleToAppliedMessage < ActiveRecord::Migration
+ def change
+ add_column :applied_messages, :role, :integer
+ end
+end
diff --git a/db/migrate/20160729124833_add_project_id_to_applied_message.rb b/db/migrate/20160729124833_add_project_id_to_applied_message.rb
new file mode 100644
index 000000000..803c5d8aa
--- /dev/null
+++ b/db/migrate/20160729124833_add_project_id_to_applied_message.rb
@@ -0,0 +1,5 @@
+class AddProjectIdToAppliedMessage < ActiveRecord::Migration
+ def change
+ add_column :applied_messages, :project_id, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8d845f9d2..f8a113834 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,2300 +1,2714 @@
-# 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 => 20160725091759) do
-
- create_table "activities", :force => true do |t|
- t.integer "act_id", :null => false
- t.string "act_type", :null => false
- t.integer "user_id", :null => false
- t.integer "activity_container_id"
- t.string "activity_container_type", :default => ""
- t.datetime "created_at"
- end
-
- add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
- add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
- add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
-
- create_table "activity_notifies", :force => true do |t|
- t.integer "activity_container_id"
- t.string "activity_container_type"
- t.integer "activity_id"
- t.string "activity_type"
- t.integer "notify_to"
- t.datetime "created_on"
- t.integer "is_read"
- end
-
- add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
- add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
- add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
-
- create_table "api_keys", :force => true do |t|
- t.string "access_token"
- t.datetime "expires_at"
- t.integer "user_id"
- t.boolean "active", :default => true
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
- add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
-
- create_table "applied_projects", :force => true do |t|
- t.integer "project_id", :null => false
- t.integer "user_id", :null => false
- end
-
- create_table "apply_add_schools", :force => true do |t|
- t.string "name"
- t.string "province"
- t.string "city"
- t.string "address"
- t.string "remarks"
- t.integer "school_id"
- t.integer "status", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "user_id"
- end
-
- create_table "apply_homeworks", :force => true do |t|
- t.integer "status"
- t.integer "user_id"
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "apply_homeworks", ["homework_common_id"], :name => "index_apply_homeworks_on_homework_common_id"
- add_index "apply_homeworks", ["user_id"], :name => "index_apply_homeworks_on_user_id"
-
- 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 "apply_resources", :force => true do |t|
- t.integer "status"
- t.integer "user_id"
- t.integer "attachment_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "container_id"
- t.string "container_type"
- t.text "content"
- t.integer "apply_user_id"
- end
-
- create_table "at_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "at_message_id"
- t.string "at_message_type"
- t.boolean "viewed", :default => false
- t.string "container_type"
- t.integer "container_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "sender_id"
- end
-
- add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
-
- create_table "attachment_histories", :force => true do |t|
- t.integer "container_id"
- t.string "container_type"
- t.string "filename", :default => ""
- t.string "disk_filename", :default => ""
- t.integer "filesize", :default => 0
- t.string "content_type", :default => ""
- t.string "digest", :limit => 40, :default => ""
- t.integer "downloads", :default => 0
- t.integer "author_id"
- t.datetime "created_on"
- t.string "description"
- t.string "disk_directory"
- t.integer "attachtype"
- t.integer "is_public"
- t.integer "copy_from"
- t.integer "quotes"
- t.integer "version"
- t.integer "attachment_id"
- t.integer "is_publish", :default => 1
- t.date "publish_time"
- 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"
- t.integer "is_publish", :default => 1
- t.date "publish_time"
- end
-
- add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
- add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
- add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
-
- create_table "attachmentstypes", :force => true do |t|
- t.integer "typeId", :null => false
- t.string "typeName", :limit => 50
- end
-
- create_table "auth_sources", :force => true do |t|
- t.string "type", :limit => 30, :default => "", :null => false
- t.string "name", :limit => 60, :default => "", :null => false
- t.string "host", :limit => 60
- t.integer "port"
- t.string "account"
- t.string "account_password", :default => ""
- t.string "base_dn"
- t.string "attr_login", :limit => 30
- t.string "attr_firstname", :limit => 30
- t.string "attr_lastname", :limit => 30
- t.string "attr_mail", :limit => 30
- t.boolean "onthefly_register", :default => false, :null => false
- t.boolean "tls", :default => false, :null => false
- t.string "filter"
- t.integer "timeout"
- end
-
- add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
-
- create_table "biding_projects", :force => true do |t|
- t.integer "project_id"
- t.integer "bid_id"
- t.integer "user_id"
- t.string "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "reward"
- end
-
- create_table "bids", :force => true do |t|
- t.string "name"
- t.string "budget", :null => false
- t.integer "author_id"
- t.date "deadline"
- t.text "description"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- t.integer "commit"
- t.integer "reward_type"
- t.integer "homework_type"
- t.integer "parent_id"
- t.string "password"
- t.integer "is_evaluation"
- t.integer "proportion", :default => 60
- t.integer "comment_status", :default => 0
- t.integer "evaluation_num", :default => 3
- t.integer "open_anonymous_evaluation", :default => 1
- end
-
- create_table "blog_comments", :force => true do |t|
- t.integer "blog_id", :null => false
- t.integer "parent_id"
- t.string "title", :default => "", :null => false
- t.text "content"
- t.integer "author_id"
- t.integer "comments_count", :default => 0, :null => false
- t.integer "last_comment_id"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- t.boolean "locked", :default => false
- t.integer "sticky", :default => 0
- t.integer "reply_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "blogs", :force => true do |t|
- t.string "name", :default => "", :null => false
- t.text "description"
- t.integer "position", :default => 1
- t.integer "article_count", :default => 0, :null => false
- t.integer "comments_count", :default => 0, :null => false
- t.integer "last_comments_id"
- t.integer "parent_id"
- t.integer "author_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "homepage_id"
- end
-
- create_table "boards", :force => true do |t|
- t.integer "project_id", :null => false
- t.string "name", :default => "", :null => false
- t.string "description"
- t.integer "position", :default => 1
- t.integer "topics_count", :default => 0, :null => false
- t.integer "messages_count", :default => 0, :null => false
- t.integer "last_message_id"
- t.integer "parent_id"
- t.integer "course_id"
- t.integer "org_subfield_id"
- end
-
- add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
- add_index "boards", ["project_id"], :name => "boards_project_id"
-
- create_table "bug_to_osps", :force => true do |t|
- t.integer "osp_id"
- t.integer "relative_memo_id"
- t.string "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "changes", :force => true do |t|
- t.integer "changeset_id", :null => false
- t.string "action", :limit => 1, :default => "", :null => false
- t.text "path", :null => false
- t.text "from_path"
- t.string "from_revision"
- t.string "revision"
- t.string "branch"
- end
-
- add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
-
- create_table "changeset_parents", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "parent_id", :null => false
- end
-
- add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids"
- add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
-
- create_table "changesets", :force => true do |t|
- t.integer "repository_id", :null => false
- t.string "revision", :null => false
- t.string "committer"
- t.datetime "committed_on", :null => false
- t.text "comments"
- t.date "commit_date"
- t.string "scmid"
- t.integer "user_id"
- end
-
- add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
- add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true
- add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid"
- add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id"
- add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id"
-
- create_table "changesets_issues", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "issue_id", :null => false
- end
-
- add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
-
- create_table "code_review_assignments", :force => true do |t|
- t.integer "issue_id"
- t.integer "change_id"
- t.integer "attachment_id"
- t.string "file_path"
- t.string "rev"
- t.string "rev_to"
- t.string "action_type"
- t.integer "changeset_id"
- end
-
- create_table "code_review_project_settings", :force => true do |t|
- t.integer "project_id"
- t.integer "tracker_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "updated_by"
- t.boolean "hide_code_review_tab", :default => false
- t.integer "auto_relation", :default => 1
- t.integer "assignment_tracker_id"
- t.text "auto_assign"
- t.integer "lock_version", :default => 0, :null => false
- t.boolean "tracker_in_review_dialog", :default => false
- end
-
- create_table "code_review_user_settings", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.integer "mail_notification", :default => 0, :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "code_reviews", :force => true do |t|
- t.integer "project_id"
- t.integer "change_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "line"
- t.integer "updated_by_id"
- t.integer "lock_version", :default => 0, :null => false
- t.integer "status_changed_from"
- t.integer "status_changed_to"
- t.integer "issue_id"
- t.string "action_type"
- t.string "file_path"
- t.string "rev"
- t.string "rev_to"
- t.integer "attachment_id"
- t.integer "file_count", :default => 0, :null => false
- t.boolean "diff_all"
- end
-
- create_table "code_tests", :force => true do |t|
- t.integer "homework_id"
- t.integer "wait_time", :default => 0
- t.integer "language"
- t.integer "status"
- t.integer "time_used", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "student_work_id", :default => 0
- 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
- t.integer "parent_id"
- t.integer "comments_count", :default => 0
- t.integer "reply_id"
- 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 "commits", :force => true do |t|
- t.integer "repository_id"
- t.string "version"
- t.string "committer"
- t.text "comments"
- t.datetime "committed_on"
- t.integer "project_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contest_notifications", :force => true do |t|
- t.text "title"
- t.text "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contesting_projects", :force => true do |t|
- t.integer "project_id"
- t.string "contest_id"
- t.integer "user_id"
- t.string "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "reward"
- end
-
- create_table "contesting_softapplications", :force => true do |t|
- t.integer "softapplication_id"
- t.integer "contest_id"
- t.integer "user_id"
- t.string "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "reward"
- end
-
- create_table "contestnotifications", :force => true do |t|
- t.integer "contest_id"
- t.string "title"
- t.string "summary"
- t.text "description"
- t.integer "author_id"
- t.integer "notificationcomments_count"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contests", :force => true do |t|
- t.string "name"
- t.string "budget", :default => ""
- t.integer "author_id"
- t.date "deadline"
- t.string "description"
- t.integer "commit"
- t.string "password"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- end
-
- create_table "course_activities", :force => true do |t|
- t.integer "user_id"
- t.integer "course_id"
- t.integer "course_act_id"
- t.string "course_act_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index"
-
- create_table "course_attachments", :force => true do |t|
- t.string "filename"
- t.string "disk_filename"
- t.integer "filesize"
- t.string "content_type"
- t.string "digest"
- t.integer "downloads"
- t.string "author_id"
- t.string "integer"
- t.string "description"
- t.string "disk_directory"
- t.integer "attachtype"
- t.integer "is_public"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "container_id", :default => 0
- end
-
- create_table "course_contributor_scores", :force => true do |t|
- t.integer "course_id"
- t.integer "user_id"
- t.integer "message_num", :default => 0
- t.integer "message_reply_num", :default => 0
- t.integer "news_reply_num", :default => 0
- t.integer "resource_num", :default => 0
- t.integer "journal_num", :default => 0
- t.integer "journal_reply_num", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "total_score", :default => 0
- t.integer "homework_journal_num", :default => 0
- t.integer "news_num", :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_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "course_id"
- t.integer "course_message_id"
- t.string "course_message_type"
- t.integer "viewed"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "content"
- t.integer "status"
- t.integer "apply_user_id"
- t.integer "apply_result"
- end
-
- add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type"
- add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at"
-
- create_table "course_statuses", :force => true do |t|
- t.integer "changesets_count"
- t.integer "watchers_count"
- t.integer "course_id"
- t.float "grade", :default => 0.0
- t.integer "course_ac_para", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "courses", :force => true do |t|
- t.integer "tea_id"
- t.string "name"
- t.integer "state"
- t.string "code"
- t.integer "time"
- t.string "extra"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "location"
- t.string "term"
- t.string "string"
- t.string "password"
- t.string "setup_time"
- t.string "endup_time"
- t.string "class_period"
- t.integer "school_id"
- t.text "description"
- t.integer "status", :default => 1
- t.integer "attachmenttype", :default => 2
- t.integer "lft"
- t.integer "rgt"
- t.integer "is_public", :limit => 1, :default => 1
- t.integer "inherit_members", :limit => 1, :default => 1
- t.integer "open_student", :default => 0
- t.integer "outline", :default => 0
- t.integer "publish_resource", :default => 0
- t.integer "is_delete", :default => 0
- t.integer "end_time"
- t.string "end_term"
- t.integer "is_excellent", :default => 0
- t.integer "excellent_option", :default => 0
- t.integer "is_copy", :default => 0
- t.integer "visits", :default => 0
- t.integer "syllabus_id"
- t.string "invite_code"
- t.string "qrcode"
- end
-
- add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
- add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id"
-
- create_table "custom_fields", :force => true do |t|
- t.string "type", :limit => 30, :default => "", :null => false
- t.string "name", :limit => 30, :default => "", :null => false
- t.string "field_format", :limit => 30, :default => "", :null => false
- t.text "possible_values"
- t.string "regexp", :default => ""
- t.integer "min_length", :default => 0, :null => false
- t.integer "max_length", :default => 0, :null => false
- t.boolean "is_required", :default => false, :null => false
- t.boolean "is_for_all", :default => false, :null => false
- t.boolean "is_filter", :default => false, :null => false
- t.integer "position", :default => 1
- t.boolean "searchable", :default => false
- t.text "default_value"
- t.boolean "editable", :default => true
- t.boolean "visible", :default => true, :null => false
- t.boolean "multiple", :default => false
- end
-
- add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type"
-
- create_table "custom_fields_projects", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "project_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true
-
- create_table "custom_fields_trackers", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "tracker_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true
-
- create_table "custom_values", :force => true do |t|
- t.string "customized_type", :limit => 30, :default => "", :null => false
- t.integer "customized_id", :default => 0, :null => false
- t.integer "custom_field_id", :default => 0, :null => false
- t.text "value"
- end
-
- add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
- add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
-
- create_table "delayed_jobs", :force => true do |t|
- t.integer "priority", :default => 0, :null => false
- t.integer "attempts", :default => 0, :null => false
- t.text "handler", :null => false
- t.text "last_error"
- t.datetime "run_at"
- t.datetime "locked_at"
- t.datetime "failed_at"
- t.string "locked_by"
- t.string "queue"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
-
- create_table "discuss_demos", :force => true do |t|
- t.string "title"
- t.text "body"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "documents", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.integer "category_id", :default => 0, :null => false
- t.string "title", :limit => 60, :default => "", :null => false
- t.text "description"
- t.datetime "created_on"
- t.integer "user_id", :default => 0
- t.integer "is_public", :default => 1
- end
-
- add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
- add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
- add_index "documents", ["project_id"], :name => "documents_project_id"
-
- create_table "dts", :primary_key => "Num", :force => true do |t|
- t.string "Defect", :limit => 50
- t.string "Category", :limit => 50
- t.string "File"
- t.string "Method"
- t.string "Module", :limit => 20
- t.string "Variable", :limit => 50
- t.integer "StartLine"
- t.integer "IPLine"
- t.string "IPLineCode", :limit => 200
- t.string "Judge", :limit => 15
- t.integer "Review", :limit => 1
- t.string "Description"
- t.text "PreConditions", :limit => 2147483647
- t.text "TraceInfo", :limit => 2147483647
- t.text "Code", :limit => 2147483647
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "id", :null => false
- end
-
- create_table "editor_of_documents", :force => true do |t|
- t.integer "editor_id"
- t.integer "org_document_comment_id"
- t.datetime "created_at"
- end
-
- create_table "enabled_modules", :force => true do |t|
- t.integer "project_id"
- t.string "name", :null => false
- t.integer "course_id"
- end
-
- add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
-
- create_table "enumerations", :force => true do |t|
- t.string "name", :limit => 30, :default => "", :null => false
- t.integer "position", :default => 1
- t.boolean "is_default", :default => false, :null => false
- t.string "type"
- t.boolean "active", :default => true, :null => false
- t.integer "project_id"
- t.integer "parent_id"
- t.string "position_name", :limit => 30
- end
-
- add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
- add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
-
- create_table "exercise_answers", :force => true do |t|
- t.integer "user_id"
- t.integer "exercise_question_id"
- t.integer "exercise_choice_id"
- t.text "answer_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "exercise_choices", :force => true do |t|
- t.integer "exercise_question_id"
- t.text "choice_text"
- t.integer "choice_position"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "exercise_questions", :force => true do |t|
- t.text "question_title"
- t.integer "question_type"
- t.integer "question_number"
- t.integer "exercise_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "question_score"
- end
-
- create_table "exercise_standard_answers", :force => true do |t|
- t.integer "exercise_question_id"
- t.integer "exercise_choice_id"
- t.text "answer_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "exercise_users", :force => true do |t|
- t.integer "user_id"
- t.integer "exercise_id"
- t.integer "score"
- t.datetime "start_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.datetime "end_at"
- t.integer "status"
- end
-
- create_table "exercises", :force => true do |t|
- t.text "exercise_name"
- t.text "exercise_description"
- t.integer "course_id"
- t.integer "exercise_status"
- t.integer "user_id"
- t.integer "time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.datetime "publish_time"
- t.datetime "end_time"
- t.integer "show_result"
- end
-
- create_table "first_pages", :force => true do |t|
- t.string "web_title"
- t.string "title"
- t.text "description"
- t.string "page_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "sort_type"
- t.integer "image_width", :default => 107
- t.integer "image_height", :default => 63
- t.integer "show_course", :default => 1
- t.integer "show_contest", :default => 1
- end
-
- create_table "forge_activities", :force => true do |t|
- t.integer "user_id"
- t.integer "project_id"
- t.integer "forge_act_id"
- t.string "forge_act_type"
- t.integer "org_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
- add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index"
-
- create_table "forge_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "project_id"
- t.integer "forge_message_id"
- t.string "forge_message_type"
- t.integer "viewed"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "secret_key"
- t.integer "status"
- end
-
- add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
- add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
-
- 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 "forwards", :force => true do |t|
- t.integer "from_id"
- t.string "from_type"
- t.integer "to_id"
- t.string "to_type"
- t.datetime "created_at"
- end
-
- create_table "groups_users", :id => false, :force => true do |t|
- t.integer "group_id", :null => false
- t.integer "user_id", :null => false
- end
-
- add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
-
- create_table "homework_attaches", :force => true do |t|
- t.integer "bid_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "reward"
- t.string "name"
- t.text "description"
- t.integer "state"
- t.integer "project_id", :default => 0
- t.float "score", :default => 0.0
- t.integer "is_teacher_score", :default => 0
- end
-
- add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
-
- create_table "homework_commons", :force => true do |t|
- t.string "name"
- t.integer "user_id"
- t.text "description"
- t.date "publish_time"
- t.date "end_time"
- t.integer "homework_type", :default => 1
- t.string "late_penalty"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "teacher_priority", :default => 1
- t.integer "anonymous_comment", :default => 0
- t.integer "quotes", :default => 0
- t.integer "is_open", :default => 0
- t.datetime "simi_time"
- end
-
- add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
-
- create_table "homework_detail_groups", :force => true do |t|
- t.integer "homework_common_id"
- t.integer "min_num"
- t.integer "max_num"
- t.integer "base_on_project"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id"
-
- create_table "homework_detail_manuals", :force => true do |t|
- t.float "ta_proportion"
- t.integer "comment_status"
- t.date "evaluation_start"
- t.date "evaluation_end"
- t.integer "evaluation_num"
- t.integer "absence_penalty", :default => 1
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "homework_detail_programings", :force => true do |t|
- t.string "language"
- t.text "standard_code", :limit => 2147483647
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.float "ta_proportion", :default => 0.1
- t.integer "question_id"
- end
-
- create_table "homework_evaluations", :force => true do |t|
- t.string "user_id"
- t.string "homework_attach_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "homework_for_courses", :force => true do |t|
- t.integer "course_id"
- t.integer "bid_id"
- end
-
- add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
- add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
-
- create_table "homework_tests", :force => true do |t|
- t.text "input"
- t.text "output"
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "result"
- t.text "error_msg"
- end
-
- create_table "homework_users", :force => true do |t|
- t.string "homework_attach_id"
- t.string "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "invite_lists", :force => true do |t|
- t.integer "project_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "mail"
- end
-
- create_table "issue_categories", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.string "name", :limit => 30, :default => "", :null => false
- t.integer "assigned_to_id"
- end
-
- add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id"
- add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
-
- create_table "issue_relations", :force => true do |t|
- t.integer "issue_from_id", :null => false
- t.integer "issue_to_id", :null => false
- t.string "relation_type", :default => "", :null => false
- t.integer "delay"
- end
-
- add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true
- add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id"
- add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id"
-
- create_table "issue_statuses", :force => true do |t|
- t.string "name", :limit => 30, :default => "", :null => false
- t.boolean "is_closed", :default => false, :null => false
- t.boolean "is_default", :default => false, :null => false
- t.integer "position", :default => 1
- t.integer "default_done_ratio"
- end
-
- add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed"
- add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default"
- add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position"
-
- create_table "issues", :force => true do |t|
- t.integer "tracker_id", :null => false
- t.integer "project_id", :null => false
- t.string "subject", :default => "", :null => false
- t.text "description"
- t.date "due_date"
- t.integer "category_id"
- t.integer "status_id", :null => false
- t.integer "assigned_to_id"
- t.integer "priority_id", :null => false
- t.integer "fixed_version_id"
- t.integer "author_id", :null => false
- t.integer "lock_version", :default => 0, :null => false
- t.datetime "created_on"
- t.datetime "updated_on"
- t.date "start_date"
- t.integer "done_ratio", :default => 0, :null => false
- t.float "estimated_hours"
- t.integer "parent_id"
- t.integer "root_id"
- t.integer "lft"
- t.integer "rgt"
- t.boolean "is_private", :default => false, :null => false
- t.datetime "closed_on"
- t.integer "project_issues_index"
- end
-
- add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id"
- add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
- add_index "issues", ["category_id"], :name => "index_issues_on_category_id"
- add_index "issues", ["created_on"], :name => "index_issues_on_created_on"
- add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id"
- add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id"
- add_index "issues", ["project_id"], :name => "issues_project_id"
- add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt"
- add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
- add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
-
- create_table "join_in_competitions", :force => true do |t|
- t.integer "user_id"
- t.integer "competition_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "join_in_contests", :force => true do |t|
- t.integer "user_id"
- t.integer "bid_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "journal_details", :force => true do |t|
- t.integer "journal_id", :default => 0, :null => false
- t.string "property", :limit => 30, :default => "", :null => false
- t.string "prop_key", :limit => 30, :default => "", :null => false
- t.text "old_value"
- t.text "value"
- end
-
- add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
-
- create_table "journal_replies", :id => false, :force => true do |t|
- t.integer "journal_id"
- t.integer "user_id"
- t.integer "reply_id"
- end
-
- add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id"
- add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id"
- add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id"
-
- create_table "journals", :force => true do |t|
- t.integer "journalized_id", :default => 0, :null => false
- t.string "journalized_type", :limit => 30, :default => "", :null => false
- t.integer "user_id", :default => 0, :null => false
- t.text "notes"
- t.datetime "created_on", :null => false
- t.boolean "private_notes", :default => false, :null => false
- t.integer "parent_id"
- t.integer "comments_count", :default => 0
- t.integer "reply_id"
- end
-
- add_index "journals", ["created_on"], :name => "index_journals_on_created_on"
- add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
- add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id"
- add_index "journals", ["user_id"], :name => "index_journals_on_user_id"
-
- create_table "journals_for_messages", :force => true do |t|
- t.integer "jour_id"
- t.string "jour_type"
- t.integer "user_id"
- t.text "notes"
- t.integer "status"
- t.integer "reply_id"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- t.string "m_parent_id"
- t.boolean "is_readed"
- t.integer "m_reply_count"
- t.integer "m_reply_id"
- t.integer "is_comprehensive_evaluation"
- t.integer "private", :default => 0
- end
-
- create_table "kindeditor_assets", :force => true do |t|
- t.string "asset"
- t.integer "file_size"
- t.string "file_type"
- t.integer "owner_id"
- t.string "asset_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "owner_type", :default => 0
- end
-
- create_table "member_roles", :force => true do |t|
- t.integer "member_id", :null => false
- t.integer "role_id", :null => false
- t.integer "inherited_from"
- end
-
- add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
- add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id"
-
- create_table "members", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.integer "project_id", :default => 0
- t.datetime "created_on"
- t.boolean "mail_notification", :default => false, :null => false
- t.integer "course_id", :default => -1
- t.integer "course_group_id", :default => 0
- end
-
- add_index "members", ["project_id"], :name => "index_members_on_project_id"
- add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
- add_index "members", ["user_id"], :name => "index_members_on_user_id"
-
- create_table "memo_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "forum_id"
- t.integer "memo_id"
- t.string "memo_type"
- t.integer "viewed"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type"
- add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at"
-
- create_table "memos", :force => true do |t|
- t.integer "forum_id", :null => false
- t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :null => false
- t.integer "author_id", :null => false
- t.integer "replies_count", :default => 0
- t.integer "last_reply_id"
- t.boolean "lock", :default => false
- t.boolean "sticky", :default => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "viewed_count", :default => 0
- end
-
- create_table "message_alls", :force => true do |t|
- t.integer "user_id"
- t.integer "message_id"
- t.string "message_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type"
- add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at"
-
- create_table "messages", :force => true do |t|
- t.integer "board_id", :null => false
- t.integer "parent_id"
- t.string "subject", :default => "", :null => false
- t.text "content"
- t.integer "author_id"
- t.integer "replies_count", :default => 0, :null => false
- t.integer "last_reply_id"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- t.boolean "locked", :default => false
- t.integer "sticky", :default => 0
- t.integer "reply_id"
- t.integer "quotes"
- t.integer "status", :default => 0
- end
-
- add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
- add_index "messages", ["board_id"], :name => "messages_board_id"
- add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
- add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
- add_index "messages", ["parent_id"], :name => "messages_parent_id"
-
- create_table "news", :force => true do |t|
- t.integer "project_id"
- t.string "title", :limit => 60, :default => "", :null => false
- t.string "summary", :default => ""
- t.text "description"
- t.integer "author_id", :default => 0, :null => false
- t.datetime "created_on"
- t.integer "comments_count", :default => 0, :null => false
- t.integer "course_id"
- t.integer "sticky", :default => 0
- t.integer "org_subfield_id"
- end
-
- add_index "news", ["author_id"], :name => "index_news_on_author_id"
- add_index "news", ["created_on"], :name => "index_news_on_created_on"
- add_index "news", ["project_id"], :name => "news_project_id"
-
- create_table "no_uses", :force => true do |t|
- t.integer "user_id", :null => false
- t.string "no_use_type"
- t.integer "no_use_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "notificationcomments", :force => true do |t|
- t.string "notificationcommented_type"
- t.integer "notificationcommented_id"
- t.integer "author_id"
- t.text "notificationcomments"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "onclick_times", :force => true do |t|
- t.integer "user_id"
- t.datetime "onclick_time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "open_id_authentication_associations", :force => true do |t|
- t.integer "issued"
- t.integer "lifetime"
- t.string "handle"
- t.string "assoc_type"
- t.binary "server_url"
- t.binary "secret"
- end
-
- create_table "open_id_authentication_nonces", :force => true do |t|
- t.integer "timestamp", :null => false
- t.string "server_url"
- t.string "salt", :null => false
- end
-
- create_table "open_source_projects", :force => true do |t|
- t.string "name"
- t.text "description"
- t.integer "commit_count", :default => 0
- t.integer "code_line", :default => 0
- t.integer "users_count", :default => 0
- t.date "last_commit_time"
- t.string "url"
- t.date "date_collected"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "option_numbers", :force => true do |t|
- t.integer "user_id"
- t.integer "memo"
- t.integer "messages_for_issues"
- t.integer "issues_status"
- t.integer "replay_for_message"
- t.integer "replay_for_memo"
- t.integer "follow"
- t.integer "tread"
- t.integer "praise_by_one"
- t.integer "praise_by_two"
- t.integer "praise_by_three"
- t.integer "tread_by_one"
- t.integer "tread_by_two"
- t.integer "tread_by_three"
- t.integer "changeset"
- t.integer "document"
- t.integer "attachment"
- t.integer "issue_done_ratio"
- t.integer "post_issue"
- t.integer "score_type"
- t.integer "total_score"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "project_id"
- end
-
- create_table "org_activities", :force => true do |t|
- t.integer "user_id"
- t.integer "org_act_id"
- t.string "org_act_type"
- t.integer "container_id"
- t.string "container_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "org_courses", :force => true do |t|
- t.integer "organization_id"
- t.integer "course_id"
- t.datetime "created_at"
- end
-
- create_table "org_document_comments", :force => true do |t|
- t.text "title"
- t.text "content"
- t.integer "organization_id"
- t.integer "creator_id"
- t.integer "parent_id"
- t.integer "reply_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.boolean "locked", :default => false
- t.integer "sticky", :default => 0
- t.integer "org_subfield_id"
- t.integer "status", :default => 0
- end
-
- create_table "org_member_roles", :force => true do |t|
- t.integer "org_member_id"
- t.integer "role_id"
- end
-
- create_table "org_members", :force => true do |t|
- t.integer "user_id"
- t.integer "organization_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "org_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "sender_id"
- t.integer "organization_id"
- t.string "message_type"
- t.integer "message_id"
- t.integer "viewed"
- t.string "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "status", :default => 0
- end
-
- create_table "org_projects", :force => true do |t|
- t.integer "organization_id"
- t.integer "project_id"
- t.datetime "created_at"
- end
-
- create_table "org_subfield_messages", :force => true do |t|
- t.integer "org_subfield_id"
- t.integer "message_id"
- t.string "message_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "org_subfields", :force => true do |t|
- t.integer "organization_id"
- t.integer "priority"
- t.string "name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "field_type"
- t.integer "hide", :default => 0
- t.integer "status", :default => 1
- end
-
- create_table "organizations", :force => true do |t|
- t.string "name"
- t.text "description"
- t.integer "creator_id"
- t.integer "home_id"
- t.boolean "is_public"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.boolean "allow_guest_download", :default => true
- t.integer "visits", :default => 0
- t.integer "show_mode", :default => 0
- t.integer "allow_teacher", :default => 0
- end
-
- create_table "phone_app_versions", :force => true do |t|
- t.string "version"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_answers", :force => true do |t|
- t.integer "poll_question_id"
- t.text "answer_text"
- t.integer "answer_position"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_questions", :force => true do |t|
- t.string "question_title"
- t.integer "question_type"
- t.integer "is_necessary"
- t.integer "poll_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "question_number"
- end
-
- create_table "poll_users", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_votes", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_question_id"
- t.integer "poll_answer_id"
- t.text "vote_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "polls", :force => true do |t|
- t.string "polls_name"
- t.string "polls_type"
- t.integer "polls_group_id"
- t.integer "polls_status"
- t.integer "user_id"
- t.datetime "published_at"
- t.datetime "closed_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "polls_description"
- t.integer "show_result", :default => 1
- end
-
- create_table "praise_tread_caches", :force => true do |t|
- t.integer "object_id", :null => false
- t.string "object_type"
- t.integer "praise_num"
- t.integer "tread_num"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "praise_treads", :force => true do |t|
- t.integer "user_id", :null => false
- t.integer "praise_tread_object_id"
- t.string "praise_tread_object_type"
- t.integer "praise_or_tread"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "principal_activities", :force => true do |t|
- t.integer "user_id"
- t.integer "principal_id"
- t.integer "principal_act_id"
- t.string "principal_act_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "project_infos", :force => true do |t|
- t.integer "project_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "project_scores", :force => true do |t|
- t.string "project_id"
- t.integer "score"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "issue_num", :default => 0
- t.integer "issue_journal_num", :default => 0
- t.integer "news_num", :default => 0
- t.integer "documents_num", :default => 0
- t.integer "changeset_num", :default => 0
- t.integer "board_message_num", :default => 0
- t.integer "board_num", :default => 0
- t.integer "attach_num", :default => 0
- t.datetime "commit_time"
- end
-
- create_table "project_statuses", :force => true do |t|
- t.integer "changesets_count"
- t.integer "watchers_count"
- t.integer "project_id"
- t.integer "project_type"
- t.float "grade", :default => 0.0
- t.integer "course_ac_para", :default => 0
- end
-
- add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
-
- create_table "projecting_softapplictions", :force => true do |t|
- t.integer "user_id"
- t.integer "softapplication_id"
- t.integer "project_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "projects", :force => true do |t|
- t.string "name", :default => "", :null => false
- t.text "description"
- t.string "homepage", :default => ""
- t.boolean "is_public", :default => true, :null => false
- t.integer "parent_id"
- t.datetime "created_on"
- t.datetime "updated_on"
- t.string "identifier"
- t.integer "status", :default => 1, :null => false
- t.integer "lft"
- t.integer "rgt"
- t.boolean "inherit_members", :default => false, :null => false
- t.integer "project_type"
- t.boolean "hidden_repo", :default => false, :null => false
- t.integer "attachmenttype", :default => 1
- t.integer "user_id"
- t.integer "dts_test", :default => 0
- t.string "enterprise_name"
- t.integer "organization_id"
- t.integer "project_new_type"
- t.integer "gpid"
- t.integer "forked_from_project_id"
- t.integer "forked_count"
- t.integer "commits_count", :default => 0
- t.integer "publish_resource", :default => 0
- t.integer "issues_count", :default => 0
- t.integer "attachments_count", :default => 0
- t.integer "boards_count", :default => 0
- t.integer "news_count", :default => 0
- t.integer "acts_count", :default => 0
- t.integer "journals_count", :default => 0
- t.integer "boards_reply_count", :default => 0
- t.integer "visits", :default => 0
- t.integer "hot", :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 "quality_analyses", :force => true do |t|
- t.integer "project_id"
- t.string "author_login"
- t.string "rep_identifier"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "sonar_version", :default => 0
- t.string "path"
- t.string "branch"
- t.string "language"
- t.string "sonar_name"
- end
-
- 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 "rep_statics", :force => true do |t|
- t.integer "project_id"
- t.integer "commits_num"
- t.string "uname"
- t.string "email"
- t.integer "add"
- t.integer "del"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "changeset"
- end
-
- create_table "repositories", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.string "url", :default => "", :null => false
- t.string "login", :limit => 60, :default => ""
- t.string "password", :default => ""
- t.string "root_url", :default => ""
- t.string "type"
- t.string "path_encoding", :limit => 64
- t.string "log_encoding", :limit => 64
- t.text "extra_info"
- t.string "identifier"
- t.boolean "is_default", :default => false
- t.boolean "hidden", :default => false
- end
-
- add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
-
- create_table "rich_rich_files", :force => true do |t|
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "rich_file_file_name"
- t.string "rich_file_content_type"
- t.integer "rich_file_file_size"
- t.datetime "rich_file_updated_at"
- t.string "owner_type"
- t.integer "owner_id"
- t.text "uri_cache"
- t.string "simplified_type", :default => "file"
- end
-
- create_table "roles", :force => true do |t|
- t.string "name", :limit => 30, :default => "", :null => false
- t.integer "position", :default => 1
- t.boolean "assignable", :default => true
- t.integer "builtin", :default => 0, :null => false
- t.text "permissions"
- t.string "issues_visibility", :limit => 30, :default => "default", :null => false
- end
-
- create_table "schools", :force => true do |t|
- t.string "name"
- t.string "province"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "logo_link"
- t.string "pinyin"
- t.integer "school_type", :default => 0
- end
-
- create_table "secdomains", :force => true do |t|
- t.integer "sub_type"
- t.string "subname"
- t.integer "pid", :default => 0
- t.string "desc"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "seems_rateable_cached_ratings", :force => true do |t|
- t.integer "cacheable_id", :limit => 8
- t.string "cacheable_type"
- t.float "avg", :null => false
- t.integer "cnt", :null => false
- t.string "dimension"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "seems_rateable_rates", :force => true do |t|
- t.integer "rater_id", :limit => 8
- t.integer "rateable_id"
- t.string "rateable_type"
- t.float "stars", :null => false
- t.string "dimension"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "is_teacher_score", :default => 0
- end
-
- create_table "settings", :force => true do |t|
- t.string "name", :default => "", :null => false
- t.text "value"
- t.datetime "updated_on"
- end
-
- add_index "settings", ["name"], :name => "index_settings_on_name"
-
- create_table "shares", :force => true do |t|
- t.date "created_on"
- t.string "url"
- t.string "title"
- t.integer "share_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "project_id"
- t.integer "user_id"
- t.string "description"
- end
-
- create_table "shield_activities", :force => true do |t|
- t.string "container_type"
- t.integer "container_id"
- t.string "shield_type"
- t.integer "shield_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "shield_wechat_messages", :force => true do |t|
- t.integer "container_id"
- t.string "container_type"
- t.integer "shield_id"
- t.string "shield_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "softapplications", :force => true do |t|
- t.string "name"
- t.text "description"
- t.integer "app_type_id"
- t.string "app_type_name"
- t.string "android_min_version_available"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "contest_id"
- t.integer "softapplication_id"
- t.integer "is_public"
- t.string "application_developers"
- t.string "deposit_project_url"
- t.string "deposit_project"
- t.integer "project_id"
- end
-
- create_table "sonar_errors", :force => true do |t|
- t.integer "project_id"
- t.string "jenkins_job_name"
- t.text "output"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "ssos", :force => true do |t|
- t.integer "user_id"
- t.string "openid"
- t.string "name"
- t.string "password"
- t.string "email"
- t.integer "sex"
- t.string "school"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id"
-
- create_table "student_work_projects", :force => true do |t|
- t.integer "homework_common_id"
- t.integer "student_work_id"
- t.integer "project_id"
- t.integer "user_id"
- t.integer "is_leader"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id"
- add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id"
- add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id"
- add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id"
-
- create_table "student_work_tests", :force => true do |t|
- t.integer "student_work_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "status", :default => 9
- t.text "results"
- t.text "src"
- end
-
- create_table "student_works", :force => true do |t|
- t.string "name"
- t.text "description", :limit => 2147483647
- t.integer "homework_common_id"
- t.integer "user_id"
- t.float "final_score"
- t.float "teacher_score"
- t.float "student_score"
- t.float "teaching_asistant_score"
- t.integer "project_id", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "late_penalty", :default => 0
- t.integer "absence_penalty", :default => 0
- t.float "system_score", :default => 0.0
- t.boolean "is_test", :default => false
- t.integer "simi_id"
- t.integer "simi_value"
- t.float "work_score"
- t.integer "work_status", :default => 0
- end
-
- add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
-
- create_table "student_works_evaluation_distributions", :force => true do |t|
- t.integer "student_work_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "student_works_scores", :force => true do |t|
- t.integer "student_work_id"
- t.integer "user_id"
- t.integer "score"
- t.text "comment"
- t.integer "reviewer_role"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "students_for_courses", :force => true do |t|
- t.integer "student_id"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
- add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
-
- create_table "sub_document_comments", :force => true do |t|
- t.text "content"
- t.text "title"
- t.integer "sub_domain_id"
- t.integer "creator_id"
- t.integer "parent_id"
- t.integer "reply_id"
- t.integer "locked"
- t.integer "sticky"
- t.integer "org_subfield_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "sub_domains", :force => true do |t|
- t.integer "org_subfield_id"
- t.integer "priority", :default => 0
- t.string "name"
- t.string "field_type"
- t.integer "hide", :default => 0
- t.integer "status", :default => 0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "subfield_subdomain_dirs", :force => true do |t|
- t.integer "org_subfield_id"
- t.string "name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "syllabuses", :force => true do |t|
- t.string "title"
- t.text "description"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "eng_name"
- t.integer "syllabus_type"
- t.integer "credit"
- t.integer "hours"
- t.integer "theory_hours"
- t.integer "practice_hours"
- t.string "applicable_major"
- t.string "pre_course"
- t.integer "visits", :default => 0
- t.integer "des_status", :default => 0
- end
-
- add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
-
- create_table "system_messages", :force => true do |t|
- t.integer "user_id"
- t.string "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "description"
- t.string "subject"
- end
-
- create_table "taggings", :force => true do |t|
- t.integer "tag_id"
- t.integer "taggable_id"
- t.string "taggable_type"
- t.integer "tagger_id"
- t.string "tagger_type"
- t.string "context", :limit => 128
- t.datetime "created_at"
- end
-
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
- add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
-
- create_table "tags", :force => true do |t|
- t.string "name"
- end
-
- create_table "teachers", :force => true do |t|
- t.string "tea_name"
- t.string "location"
- t.integer "couurse_time"
- t.integer "course_code"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "extra"
- end
-
- create_table "time_entries", :force => true do |t|
- t.integer "project_id", :null => false
- t.integer "user_id", :null => false
- t.integer "issue_id"
- t.float "hours", :null => false
- t.string "comments"
- t.integer "activity_id", :null => false
- t.date "spent_on", :null => false
- t.integer "tyear", :null => false
- t.integer "tmonth", :null => false
- t.integer "tweek", :null => false
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- end
-
- add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id"
- add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on"
- add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
- add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
- add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
-
- create_table "tokens", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.string "action", :limit => 30, :default => "", :null => false
- t.string "value", :limit => 40, :default => "", :null => false
- t.datetime "created_on", :null => false
- end
-
- add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
- add_index "tokens", ["value"], :name => "tokens_value", :unique => true
-
- create_table "trackers", :force => true do |t|
- t.string "name", :limit => 30, :default => "", :null => false
- t.boolean "is_in_chlog", :default => false, :null => false
- t.integer "position", :default => 1
- t.boolean "is_in_roadmap", :default => true, :null => false
- t.integer "fields_bits", :default => 0
- end
-
- create_table "user_actions", :force => true do |t|
- t.integer "user_id"
- t.string "action_type"
- t.integer "action_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "user_activities", :force => true do |t|
- t.string "act_type"
- t.integer "act_id"
- t.string "container_type"
- t.integer "container_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "user_id"
- end
-
- add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index"
-
- create_table "user_extensions", :force => true do |t|
- t.integer "user_id", :null => false
- t.date "birthday"
- t.string "brief_introduction"
- t.integer "gender"
- t.string "location"
- t.string "occupation"
- t.integer "work_experience"
- t.integer "zip_code"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "technical_title"
- t.integer "identity"
- t.string "student_id"
- t.string "teacher_realname"
- t.string "student_realname"
- t.string "location_city"
- t.integer "school_id"
- t.string "description", :default => ""
- end
-
- create_table "user_feedback_messages", :force => true do |t|
- t.integer "user_id"
- t.integer "journals_for_message_id"
- t.string "journals_for_message_type"
- t.integer "viewed"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id"
- add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at"
-
- create_table "user_grades", :force => true do |t|
- t.integer "user_id", :null => false
- t.integer "project_id", :null => false
- t.float "grade", :default => 0.0
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade"
- add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
- add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
-
- create_table "user_levels", :force => true do |t|
- t.integer "user_id"
- t.integer "level"
- end
-
- create_table "user_preferences", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.text "others"
- t.boolean "hide_mail", :default => false
- t.string "time_zone"
- end
-
- add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
-
- create_table "user_score_details", :force => true do |t|
- t.integer "current_user_id"
- t.integer "target_user_id"
- t.string "score_type"
- t.string "score_action"
- t.integer "user_id"
- t.integer "old_score"
- t.integer "new_score"
- t.integer "current_user_level"
- t.integer "target_user_level"
- t.integer "score_changeable_obj_id"
- t.string "score_changeable_obj_type"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "user_scores", :force => true do |t|
- t.integer "user_id", :null => false
- t.integer "collaboration"
- t.integer "influence"
- t.integer "skill"
- t.integer "active"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "user_statuses", :force => true do |t|
- t.integer "changesets_count"
- t.integer "watchers_count"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.float "grade", :default => 0.0
- end
-
- add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
- add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
- add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
-
- create_table "user_wechats", :force => true do |t|
- t.integer "subscribe"
- t.string "openid"
- t.string "nickname"
- t.integer "sex"
- t.string "language"
- t.string "city"
- t.string "province"
- t.string "country"
- t.string "headimgurl"
- t.string "subscribe_time"
- t.string "unionid"
- t.string "remark"
- t.integer "groupid"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "users", :force => true do |t|
- t.string "login", :default => "", :null => false
- t.string "hashed_password", :limit => 40, :default => "", :null => false
- t.string "firstname", :limit => 30, :default => "", :null => false
- t.string "lastname", :default => "", :null => false
- t.string "mail", :limit => 60, :default => "", :null => false
- t.boolean "admin", :default => false, :null => false
- t.integer "status", :default => 1, :null => false
- t.datetime "last_login_on"
- t.string "language", :limit => 5, :default => ""
- t.integer "auth_source_id"
- t.datetime "created_on"
- t.datetime "updated_on"
- t.string "type"
- t.string "identity_url"
- t.string "mail_notification", :default => "", :null => false
- t.string "salt", :limit => 64
- t.integer "gid"
- t.integer "visits", :default => 0
- t.integer "excellent_teacher", :default => 0
- t.integer "excellent_student", :default => 0
- end
-
- add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
- add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
- add_index "users", ["type"], :name => "index_users_on_type"
-
- create_table "versions", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.string "name", :default => "", :null => false
- t.string "description", :default => ""
- t.date "effective_date"
- t.datetime "created_on"
- t.datetime "updated_on"
- t.string "wiki_page_title"
- t.string "status", :default => "open"
- t.string "sharing", :default => "none", :null => false
- end
-
- add_index "versions", ["project_id"], :name => "versions_project_id"
- add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
-
- create_table "visitors", :force => true do |t|
- t.integer "user_id"
- t.integer "master_id"
- t.datetime "updated_on"
- t.datetime "created_on"
- end
-
- add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
- add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
- add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
-
- create_table "watchers", :force => true do |t|
- t.string "watchable_type", :default => "", :null => false
- t.integer "watchable_id", :default => 0, :null => false
- t.integer "user_id"
- end
-
- add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type"
- add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
- add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
-
- create_table "web_footer_companies", :force => true do |t|
- t.string "name"
- t.string "logo_size"
- t.string "url"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "web_footer_oranizers", :force => true do |t|
- t.string "name"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "wechat_logs", :force => true do |t|
- t.string "openid", :null => false
- t.text "request_raw"
- t.text "response_raw"
- t.text "session_raw"
- t.datetime "created_at", :null => false
- end
-
- add_index "wechat_logs", ["openid"], :name => "index_wechat_logs_on_openid"
-
- 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 => 20160729124833) do
+
+ create_table "activities", :force => true do |t|
+ t.integer "act_id", :null => false
+ t.string "act_type", :null => false
+ t.integer "user_id", :null => false
+ t.integer "activity_container_id"
+ t.string "activity_container_type", :default => ""
+ t.datetime "created_at"
+ end
+
+ add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
+ add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
+ add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
+
+ create_table "activity_notifies", :force => true do |t|
+ t.integer "activity_container_id"
+ t.string "activity_container_type"
+ t.integer "activity_id"
+ t.string "activity_type"
+ t.integer "notify_to"
+ t.datetime "created_on"
+ t.integer "is_read"
+ end
+
+ add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
+ add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
+ add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
+
+ create_table "api_keys", :force => true do |t|
+ t.string "access_token"
+ t.datetime "expires_at"
+ t.integer "user_id"
+ t.boolean "active", :default => true
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
+ add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
+
+ create_table "application_settings", :force => true do |t|
+ t.integer "default_projects_limit"
+ t.boolean "signup_enabled"
+ t.boolean "signin_enabled"
+ t.boolean "gravatar_enabled"
+ t.text "sign_in_text"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "home_page_url"
+ t.integer "default_branch_protection", :default => 2
+ t.boolean "twitter_sharing_enabled", :default => true
+ t.text "restricted_visibility_levels"
+ t.boolean "version_check_enabled", :default => true
+ t.integer "max_attachment_size", :default => 10, :null => false
+ t.integer "default_project_visibility"
+ t.integer "default_snippet_visibility"
+ t.text "restricted_signup_domains"
+ t.boolean "user_oauth_applications", :default => true
+ t.string "after_sign_out_path"
+ t.integer "session_expire_delay", :default => 10080, :null => false
+ end
+
+ create_table "applied_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "applied_id"
+ t.string "applied_type"
+ t.integer "viewed", :default => 0
+ t.integer "status", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "applied_user_id"
+ t.integer "role"
+ t.integer "project_id"
+ end
+
+ create_table "applied_projects", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.integer "user_id", :null => false
+ t.integer "role", :default => 0
+ t.integer "applied_user_id"
+ end
+
+ create_table "apply_add_schools", :force => true do |t|
+ t.string "name"
+ t.string "province"
+ t.string "city"
+ t.string "address"
+ t.string "remarks"
+ t.integer "school_id"
+ t.integer "status", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "user_id"
+ end
+
+ create_table "apply_homeworks", :force => true do |t|
+ t.integer "status"
+ t.integer "user_id"
+ t.integer "homework_common_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "apply_homeworks", ["homework_common_id"], :name => "index_apply_homeworks_on_homework_common_id"
+ add_index "apply_homeworks", ["user_id"], :name => "index_apply_homeworks_on_user_id"
+
+ 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 "apply_resources", :force => true do |t|
+ t.integer "status"
+ t.integer "user_id"
+ t.integer "attachment_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "container_id"
+ t.string "container_type"
+ t.text "content"
+ t.integer "apply_user_id"
+ end
+
+ create_table "at_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "at_message_id"
+ t.string "at_message_type"
+ t.boolean "viewed", :default => false
+ t.string "container_type"
+ t.integer "container_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "sender_id"
+ end
+
+ add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
+
+ create_table "attachment_histories", :force => true do |t|
+ t.integer "container_id"
+ t.string "container_type"
+ t.string "filename", :default => ""
+ t.string "disk_filename", :default => ""
+ t.integer "filesize", :default => 0
+ t.string "content_type", :default => ""
+ t.string "digest", :limit => 40, :default => ""
+ t.integer "downloads", :default => 0
+ t.integer "author_id"
+ t.datetime "created_on"
+ t.string "description"
+ t.string "disk_directory"
+ t.integer "attachtype"
+ t.integer "is_public"
+ t.integer "copy_from"
+ t.integer "quotes"
+ t.integer "version"
+ t.integer "attachment_id"
+ t.integer "is_publish", :default => 1
+ t.date "publish_time"
+ 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"
+ t.integer "is_publish", :default => 1
+ t.date "publish_time"
+ 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 "audit_events", :force => true do |t|
+ t.integer "author_id", :null => false
+ t.string "type", :null => false
+ t.integer "entity_id", :null => false
+ t.string "entity_type", :null => false
+ t.text "details"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
+ add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
+ add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
+
+ create_table "auth_sources", :force => true do |t|
+ t.string "type", :limit => 30, :default => "", :null => false
+ t.string "name", :limit => 60, :default => "", :null => false
+ t.string "host", :limit => 60
+ t.integer "port"
+ t.string "account"
+ t.string "account_password", :default => ""
+ t.string "base_dn"
+ t.string "attr_login", :limit => 30
+ t.string "attr_firstname", :limit => 30
+ t.string "attr_lastname", :limit => 30
+ t.string "attr_mail", :limit => 30
+ t.boolean "onthefly_register", :default => false, :null => false
+ t.boolean "tls", :default => false, :null => false
+ t.string "filter"
+ t.integer "timeout"
+ end
+
+ add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
+
+ create_table "biding_projects", :force => true do |t|
+ t.integer "project_id"
+ t.integer "bid_id"
+ t.integer "user_id"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "reward"
+ end
+
+ create_table "bids", :force => true do |t|
+ t.string "name"
+ t.string "budget", :null => false
+ t.integer "author_id"
+ t.date "deadline"
+ t.text "description"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ t.integer "commit"
+ t.integer "reward_type"
+ t.integer "homework_type"
+ t.integer "parent_id"
+ t.string "password"
+ t.integer "is_evaluation"
+ t.integer "proportion", :default => 60
+ t.integer "comment_status", :default => 0
+ t.integer "evaluation_num", :default => 3
+ t.integer "open_anonymous_evaluation", :default => 1
+ end
+
+ create_table "blog_comments", :force => true do |t|
+ t.integer "blog_id", :null => false
+ t.integer "parent_id"
+ t.string "title", :default => "", :null => false
+ t.text "content"
+ t.integer "author_id"
+ t.integer "comments_count", :default => 0, :null => false
+ t.integer "last_comment_id"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ t.boolean "locked", :default => false
+ t.integer "sticky", :default => 0
+ t.integer "reply_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "blogs", :force => true do |t|
+ t.string "name", :default => "", :null => false
+ t.text "description"
+ t.integer "position", :default => 1
+ t.integer "article_count", :default => 0, :null => false
+ t.integer "comments_count", :default => 0, :null => false
+ t.integer "last_comments_id"
+ t.integer "parent_id"
+ t.integer "author_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "homepage_id"
+ end
+
+ create_table "boards", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.string "name", :default => "", :null => false
+ t.string "description"
+ t.integer "position", :default => 1
+ t.integer "topics_count", :default => 0, :null => false
+ t.integer "messages_count", :default => 0, :null => false
+ t.integer "last_message_id"
+ t.integer "parent_id"
+ t.integer "course_id"
+ t.integer "org_subfield_id"
+ end
+
+ add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
+ add_index "boards", ["project_id"], :name => "boards_project_id"
+
+ create_table "broadcast_messages", :force => true do |t|
+ t.text "message", :null => false
+ t.datetime "starts_at"
+ t.datetime "ends_at"
+ t.integer "alert_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "color"
+ t.string "font"
+ end
+
+ 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"
+ t.integer "project_id"
+ t.integer "type", :default => 0
+ 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 "code_tests", :force => true do |t|
+ t.integer "homework_id"
+ t.integer "wait_time", :default => 0
+ t.integer "language"
+ t.integer "status"
+ t.integer "time_used", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "student_work_id", :default => 0
+ 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
+ t.integer "parent_id"
+ t.integer "comments_count", :default => 0
+ t.integer "reply_id"
+ 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 "commits", :force => true do |t|
+ t.integer "repository_id"
+ t.string "version"
+ t.string "committer"
+ t.text "comments"
+ t.datetime "committed_on"
+ t.integer "project_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "contest_notifications", :force => true do |t|
+ t.text "title"
+ t.text "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "contesting_projects", :force => true do |t|
+ t.integer "project_id"
+ t.string "contest_id"
+ t.integer "user_id"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "reward"
+ end
+
+ create_table "contesting_softapplications", :force => true do |t|
+ t.integer "softapplication_id"
+ t.integer "contest_id"
+ t.integer "user_id"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "reward"
+ end
+
+ create_table "contestnotifications", :force => true do |t|
+ t.integer "contest_id"
+ t.string "title"
+ t.string "summary"
+ t.text "description"
+ t.integer "author_id"
+ t.integer "notificationcomments_count"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "contests", :force => true do |t|
+ t.string "name"
+ t.string "budget", :default => ""
+ t.integer "author_id"
+ t.date "deadline"
+ t.string "description"
+ t.integer "commit"
+ t.string "password"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ end
+
+ create_table "course_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "course_id"
+ t.integer "course_act_id"
+ t.string "course_act_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index"
+
+ create_table "course_attachments", :force => true do |t|
+ t.string "filename"
+ t.string "disk_filename"
+ t.integer "filesize"
+ t.string "content_type"
+ t.string "digest"
+ t.integer "downloads"
+ t.string "author_id"
+ t.string "integer"
+ t.string "description"
+ t.string "disk_directory"
+ t.integer "attachtype"
+ t.integer "is_public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "container_id", :default => 0
+ end
+
+ create_table "course_contributor_scores", :force => true do |t|
+ t.integer "course_id"
+ t.integer "user_id"
+ t.integer "message_num", :default => 0
+ t.integer "message_reply_num", :default => 0
+ t.integer "news_reply_num", :default => 0
+ t.integer "resource_num", :default => 0
+ t.integer "journal_num", :default => 0
+ t.integer "journal_reply_num", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "total_score", :default => 0
+ t.integer "homework_journal_num", :default => 0
+ t.integer "news_num", :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_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "course_id"
+ t.integer "course_message_id"
+ t.string "course_message_type"
+ t.integer "viewed"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "content"
+ t.integer "status"
+ t.integer "apply_user_id"
+ t.integer "apply_result"
+ end
+
+ add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type"
+ add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at"
+
+ create_table "course_statuses", :force => true do |t|
+ t.integer "changesets_count"
+ t.integer "watchers_count"
+ t.integer "course_id"
+ t.float "grade", :default => 0.0
+ t.integer "course_ac_para", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "courses", :force => true do |t|
+ t.integer "tea_id"
+ t.string "name"
+ t.integer "state"
+ t.string "code"
+ t.integer "time"
+ t.string "extra"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "location"
+ t.string "term"
+ t.string "string"
+ t.string "password"
+ t.string "setup_time"
+ t.string "endup_time"
+ t.string "class_period"
+ t.integer "school_id"
+ t.text "description"
+ t.integer "status", :default => 1
+ t.integer "attachmenttype", :default => 2
+ t.integer "lft"
+ t.integer "rgt"
+ t.integer "is_public", :limit => 1, :default => 1
+ t.integer "inherit_members", :limit => 1, :default => 1
+ t.integer "open_student", :default => 0
+ t.integer "outline", :default => 0
+ t.integer "publish_resource", :default => 0
+ t.integer "is_delete", :default => 0
+ t.integer "end_time"
+ t.string "end_term"
+ t.integer "is_excellent", :default => 0
+ t.integer "excellent_option", :default => 0
+ t.integer "is_copy", :default => 0
+ t.integer "visits", :default => 0
+ t.integer "syllabus_id"
+ t.string "invite_code"
+ t.string "qrcode"
+ end
+
+ add_index "courses", ["id"], :name => "id", :unique => true
+ add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
+ add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id"
+ add_index "courses", ["tea_id"], :name => "tea_id"
+ add_index "courses", ["visits"], :name => "visits"
+
+ 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 "deploy_keys_projects", :force => true do |t|
+ t.integer "deploy_key_id", :null => false
+ t.integer "project_id", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
+
+ create_table "discuss_demos", :force => true do |t|
+ t.string "title"
+ t.text "body"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "documents", :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.integer "category_id", :default => 0, :null => false
+ t.string "title", :limit => 60, :default => "", :null => false
+ t.text "description"
+ t.datetime "created_on"
+ t.integer "user_id", :default => 0
+ t.integer "is_public", :default => 1
+ end
+
+ add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
+ add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
+ add_index "documents", ["project_id"], :name => "documents_project_id"
+
+ create_table "dts", :primary_key => "Num", :force => true do |t|
+ t.string "Defect", :limit => 50
+ t.string "Category", :limit => 50
+ t.string "File"
+ t.string "Method"
+ t.string "Module", :limit => 20
+ t.string "Variable", :limit => 50
+ t.integer "StartLine"
+ t.integer "IPLine"
+ t.string "IPLineCode", :limit => 200
+ t.string "Judge", :limit => 15
+ t.integer "Review", :limit => 1
+ t.string "Description"
+ t.text "PreConditions", :limit => 2147483647
+ t.text "TraceInfo", :limit => 2147483647
+ t.text "Code", :limit => 2147483647
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "id", :null => false
+ end
+
+ create_table "editor_of_documents", :force => true do |t|
+ t.integer "editor_id"
+ t.integer "org_document_comment_id"
+ t.datetime "created_at"
+ end
+
+ create_table "emails", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.string "email", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
+ add_index "emails", ["user_id"], :name => "index_emails_on_user_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 "events", :force => true do |t|
+ t.string "target_type"
+ t.integer "target_id"
+ t.string "title"
+ t.text "data"
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "action"
+ t.integer "author_id"
+ end
+
+ add_index "events", ["action"], :name => "index_events_on_action"
+ add_index "events", ["author_id"], :name => "index_events_on_author_id"
+ add_index "events", ["created_at"], :name => "index_events_on_created_at"
+ add_index "events", ["project_id"], :name => "index_events_on_project_id"
+ add_index "events", ["target_id"], :name => "index_events_on_target_id"
+ add_index "events", ["target_type"], :name => "index_events_on_target_type"
+
+ create_table "exercise_answers", :force => true do |t|
+ t.integer "user_id"
+ t.integer "exercise_question_id"
+ t.integer "exercise_choice_id"
+ t.text "answer_text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "exercise_choices", :force => true do |t|
+ t.integer "exercise_question_id"
+ t.text "choice_text"
+ t.integer "choice_position"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "exercise_questions", :force => true do |t|
+ t.text "question_title"
+ t.integer "question_type"
+ t.integer "question_number"
+ t.integer "exercise_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "question_score"
+ end
+
+ create_table "exercise_standard_answers", :force => true do |t|
+ t.integer "exercise_question_id"
+ t.integer "exercise_choice_id"
+ t.text "answer_text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "exercise_users", :force => true do |t|
+ t.integer "user_id"
+ t.integer "exercise_id"
+ t.integer "score"
+ t.datetime "start_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.datetime "end_at"
+ t.integer "status"
+ end
+
+ create_table "exercises", :force => true do |t|
+ t.text "exercise_name"
+ t.text "exercise_description"
+ t.integer "course_id"
+ t.integer "exercise_status"
+ t.integer "user_id"
+ t.integer "time"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.datetime "publish_time"
+ t.datetime "end_time"
+ t.integer "show_result"
+ end
+
+ create_table "first_pages", :force => true do |t|
+ t.string "web_title"
+ t.string "title"
+ t.text "description"
+ t.string "page_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "sort_type"
+ t.integer "image_width", :default => 107
+ t.integer "image_height", :default => 63
+ t.integer "show_course", :default => 1
+ t.integer "show_contest", :default => 1
+ end
+
+ create_table "forge_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "project_id"
+ t.integer "forge_act_id"
+ t.string "forge_act_type"
+ t.integer "org_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
+ add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index"
+
+ create_table "forge_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "project_id"
+ t.integer "forge_message_id"
+ t.string "forge_message_type"
+ t.integer "viewed"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "secret_key"
+ t.integer "status"
+ end
+
+ add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
+ add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
+
+ create_table "forked_project_links", :force => true do |t|
+ t.integer "forked_to_project_id", :null => false
+ t.integer "forked_from_project_id", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
+
+ 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 "forwards", :force => true do |t|
+ t.integer "from_id"
+ t.string "from_type"
+ t.integer "to_id"
+ t.string "to_type"
+ t.datetime "created_at"
+ end
+
+ create_table "groups_users", :id => false, :force => true do |t|
+ t.integer "group_id", :null => false
+ t.integer "user_id", :null => false
+ end
+
+ add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
+
+ create_table "homework_attaches", :force => true do |t|
+ t.integer "bid_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "reward"
+ t.string "name"
+ t.text "description"
+ t.integer "state"
+ t.integer "project_id", :default => 0
+ t.float "score", :default => 0.0
+ t.integer "is_teacher_score", :default => 0
+ end
+
+ add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
+
+ create_table "homework_commons", :force => true do |t|
+ t.string "name"
+ t.integer "user_id"
+ t.text "description"
+ t.date "publish_time"
+ t.date "end_time"
+ t.integer "homework_type", :default => 1
+ t.string "late_penalty"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "teacher_priority", :default => 1
+ t.integer "anonymous_comment", :default => 0
+ t.integer "quotes", :default => 0
+ t.integer "is_open", :default => 0
+ t.datetime "simi_time"
+ end
+
+ add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
+
+ create_table "homework_detail_groups", :force => true do |t|
+ t.integer "homework_common_id"
+ t.integer "min_num"
+ t.integer "max_num"
+ t.integer "base_on_project"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id"
+
+ create_table "homework_detail_manuals", :force => true do |t|
+ t.float "ta_proportion"
+ t.integer "comment_status"
+ t.date "evaluation_start"
+ t.date "evaluation_end"
+ t.integer "evaluation_num"
+ t.integer "absence_penalty", :default => 1
+ t.integer "homework_common_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "homework_detail_programings", :force => true do |t|
+ t.string "language"
+ t.text "standard_code", :limit => 2147483647
+ t.integer "homework_common_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.float "ta_proportion", :default => 0.1
+ t.integer "question_id"
+ end
+
+ create_table "homework_evaluations", :force => true do |t|
+ t.string "user_id"
+ t.string "homework_attach_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "homework_for_courses", :force => true do |t|
+ t.integer "course_id"
+ t.integer "bid_id"
+ end
+
+ add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
+ add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
+
+ create_table "homework_tests", :force => true do |t|
+ t.text "input"
+ t.text "output"
+ t.integer "homework_common_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "result"
+ t.text "error_msg"
+ end
+
+ create_table "homework_users", :force => true do |t|
+ t.string "homework_attach_id"
+ t.string "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "identities", :force => true do |t|
+ t.string "extern_uid"
+ t.string "provider"
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
+ add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
+
+ create_table "invite_lists", :force => true do |t|
+ t.integer "project_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "mail"
+ end
+
+ create_table "issue_categories", :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.string "name", :limit => 30, :default => "", :null => false
+ t.integer "assigned_to_id"
+ end
+
+ add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id"
+ add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
+
+ create_table "issue_relations", :force => true do |t|
+ t.integer "issue_from_id", :null => false
+ t.integer "issue_to_id", :null => false
+ t.string "relation_type", :default => "", :null => false
+ t.integer "delay"
+ end
+
+ add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true
+ add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id"
+ add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id"
+
+ create_table "issue_statuses", :force => true do |t|
+ t.string "name", :limit => 30, :default => "", :null => false
+ t.boolean "is_closed", :default => false, :null => false
+ t.boolean "is_default", :default => false, :null => false
+ t.integer "position", :default => 1
+ t.integer "default_done_ratio"
+ end
+
+ add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed"
+ add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default"
+ add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position"
+
+ create_table "issues", :force => true do |t|
+ t.integer "tracker_id", :null => false
+ t.integer "project_id", :null => false
+ t.string "subject", :default => "", :null => false
+ t.text "description"
+ t.date "due_date"
+ t.integer "category_id"
+ t.integer "status_id", :null => false
+ t.integer "assigned_to_id"
+ t.integer "priority_id", :null => false
+ t.integer "fixed_version_id"
+ t.integer "author_id", :null => false
+ t.integer "lock_version", :default => 0, :null => false
+ t.datetime "created_on"
+ t.datetime "updated_on"
+ t.date "start_date"
+ t.integer "done_ratio", :default => 0, :null => false
+ t.float "estimated_hours"
+ t.integer "parent_id"
+ t.integer "root_id"
+ t.integer "lft"
+ t.integer "rgt"
+ t.boolean "is_private", :default => false, :null => false
+ t.datetime "closed_on"
+ t.integer "project_issues_index"
+ end
+
+ add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id"
+ add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
+ add_index "issues", ["category_id"], :name => "index_issues_on_category_id"
+ add_index "issues", ["created_on"], :name => "index_issues_on_created_on"
+ add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id"
+ add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id"
+ add_index "issues", ["project_id"], :name => "issues_project_id"
+ add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt"
+ add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
+ add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
+
+ create_table "join_in_competitions", :force => true do |t|
+ t.integer "user_id"
+ t.integer "competition_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "join_in_contests", :force => true do |t|
+ t.integer "user_id"
+ t.integer "bid_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "journal_details", :force => true do |t|
+ t.integer "journal_id", :default => 0, :null => false
+ t.string "property", :limit => 30, :default => "", :null => false
+ t.string "prop_key", :limit => 30, :default => "", :null => false
+ t.text "old_value"
+ t.text "value"
+ end
+
+ add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
+
+ create_table "journal_replies", :id => false, :force => true do |t|
+ t.integer "journal_id"
+ t.integer "user_id"
+ t.integer "reply_id"
+ end
+
+ add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id"
+ add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id"
+ add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id"
+
+ create_table "journals", :force => true do |t|
+ t.integer "journalized_id", :default => 0, :null => false
+ t.string "journalized_type", :limit => 30, :default => "", :null => false
+ t.integer "user_id", :default => 0, :null => false
+ t.text "notes"
+ t.datetime "created_on", :null => false
+ t.boolean "private_notes", :default => false, :null => false
+ t.integer "parent_id"
+ t.integer "comments_count", :default => 0
+ t.integer "reply_id"
+ end
+
+ add_index "journals", ["created_on"], :name => "index_journals_on_created_on"
+ add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
+ add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id"
+ add_index "journals", ["user_id"], :name => "index_journals_on_user_id"
+
+ create_table "journals_for_messages", :force => true do |t|
+ t.integer "jour_id"
+ t.string "jour_type"
+ t.integer "user_id"
+ t.text "notes"
+ t.integer "status"
+ t.integer "reply_id"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ t.string "m_parent_id"
+ t.boolean "is_readed"
+ t.integer "m_reply_count"
+ t.integer "m_reply_id"
+ t.integer "is_comprehensive_evaluation"
+ t.integer "private", :default => 0
+ end
+
+ create_table "keys", :force => true do |t|
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.text "key"
+ t.string "title"
+ t.string "type"
+ t.string "fingerprint"
+ t.boolean "public", :default => false, :null => false
+ end
+
+ add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
+ add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
+
+ 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 "label_links", :force => true do |t|
+ t.integer "label_id"
+ t.integer "target_id"
+ t.string "target_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
+ add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
+
+ create_table "labels", :force => true do |t|
+ t.string "title"
+ t.string "color"
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
+
+ create_table "member_roles", :force => true do |t|
+ t.integer "member_id", :null => false
+ t.integer "role_id", :null => false
+ t.integer "inherited_from"
+ end
+
+ add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
+ add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id"
+
+ create_table "members", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "project_id", :default => 0
+ t.datetime "created_on"
+ t.boolean "mail_notification", :default => false, :null => false
+ t.integer "course_id", :default => -1
+ t.integer "course_group_id", :default => 0
+ end
+
+ add_index "members", ["project_id"], :name => "index_members_on_project_id"
+ add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
+ add_index "members", ["user_id"], :name => "index_members_on_user_id"
+
+ create_table "memo_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "forum_id"
+ t.integer "memo_id"
+ t.string "memo_type"
+ t.integer "viewed"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type"
+ add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at"
+
+ 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 "merge_request_diffs", :force => true do |t|
+ t.string "state"
+ t.text "st_commits", :limit => 2147483647
+ t.text "st_diffs", :limit => 2147483647
+ t.integer "merge_request_id", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
+
+ create_table "merge_requests", :force => true do |t|
+ t.string "target_branch", :null => false
+ t.string "source_branch", :null => false
+ t.integer "source_project_id", :null => false
+ t.integer "author_id"
+ t.integer "assignee_id"
+ t.string "title"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "milestone_id"
+ t.string "state"
+ t.string "merge_status"
+ t.integer "target_project_id", :null => false
+ t.integer "iid"
+ t.text "description"
+ t.integer "position", :default => 0
+ t.datetime "locked_at"
+ end
+
+ add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
+ add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
+ add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
+ add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
+ add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
+ add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
+ add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
+ add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
+ add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
+ add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
+
+ create_table "message_alls", :force => true do |t|
+ t.integer "user_id"
+ t.integer "message_id"
+ t.string "message_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type"
+ add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at"
+
+ create_table "messages", :force => true do |t|
+ t.integer "board_id", :null => false
+ t.integer "parent_id"
+ t.string "subject", :default => "", :null => false
+ t.text "content"
+ t.integer "author_id"
+ t.integer "replies_count", :default => 0, :null => false
+ t.integer "last_reply_id"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ t.boolean "locked", :default => false
+ t.integer "sticky", :default => 0
+ t.integer "reply_id"
+ t.integer "quotes"
+ t.integer "status", :default => 0
+ end
+
+ add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
+ add_index "messages", ["board_id"], :name => "messages_board_id"
+ add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
+ add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
+ add_index "messages", ["parent_id"], :name => "messages_parent_id"
+
+ create_table "milestones", :force => true do |t|
+ t.string "title", :null => false
+ t.integer "project_id", :null => false
+ t.text "description"
+ t.date "due_date"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "state"
+ t.integer "iid"
+ end
+
+ add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
+ add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
+ add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
+ add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
+
+ create_table "namespaces", :force => true do |t|
+ t.string "name", :null => false
+ t.string "path", :null => false
+ t.integer "owner_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "type"
+ t.string "description", :default => "", :null => false
+ t.string "avatar"
+ end
+
+ add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
+ add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
+ add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
+ add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
+ add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
+
+ create_table "news", :force => true do |t|
+ t.integer "project_id"
+ t.string "title", :limit => 60, :default => "", :null => false
+ t.string "summary", :default => ""
+ t.text "description"
+ t.integer "author_id", :default => 0, :null => false
+ t.datetime "created_on"
+ t.integer "comments_count", :default => 0, :null => false
+ t.integer "course_id"
+ t.integer "sticky", :default => 0
+ t.integer "org_subfield_id"
+ end
+
+ add_index "news", ["author_id"], :name => "index_news_on_author_id"
+ add_index "news", ["created_on"], :name => "index_news_on_created_on"
+ add_index "news", ["project_id"], :name => "news_project_id"
+
+ create_table "no_uses", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.string "no_use_type"
+ t.integer "no_use_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "notes", :force => true do |t|
+ t.text "note"
+ t.string "noteable_type"
+ t.integer "author_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "project_id"
+ t.string "attachment"
+ t.string "line_code"
+ t.string "commit_id"
+ t.integer "noteable_id"
+ t.boolean "system", :default => false, :null => false
+ t.text "st_diff", :limit => 2147483647
+ end
+
+ add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
+ add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
+ add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
+ add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
+ add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
+ add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
+ add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
+ add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
+ add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
+
+ 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 "oauth_access_grants", :force => true do |t|
+ t.integer "resource_owner_id", :null => false
+ t.integer "application_id", :null => false
+ t.string "token", :null => false
+ t.integer "expires_in", :null => false
+ t.text "redirect_uri", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "revoked_at"
+ t.string "scopes"
+ end
+
+ add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
+
+ create_table "oauth_access_tokens", :force => true do |t|
+ t.integer "resource_owner_id"
+ t.integer "application_id"
+ t.string "token", :null => false
+ t.string "refresh_token"
+ t.integer "expires_in"
+ t.datetime "revoked_at"
+ t.datetime "created_at", :null => false
+ t.string "scopes"
+ end
+
+ add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
+ add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
+ add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
+
+ create_table "oauth_applications", :force => true do |t|
+ t.string "name", :null => false
+ t.string "uid", :null => false
+ t.string "secret", :null => false
+ t.text "redirect_uri", :null => false
+ t.string "scopes", :default => "", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "owner_id"
+ t.string "owner_type"
+ end
+
+ add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
+ add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
+
+ create_table "onclick_times", :force => true do |t|
+ t.integer "user_id"
+ t.datetime "onclick_time"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "open_id_authentication_associations", :force => true do |t|
+ t.integer "issued"
+ t.integer "lifetime"
+ t.string "handle"
+ t.string "assoc_type"
+ t.binary "server_url"
+ t.binary "secret"
+ end
+
+ create_table "open_id_authentication_nonces", :force => true do |t|
+ t.integer "timestamp", :null => false
+ t.string "server_url"
+ t.string "salt", :null => false
+ end
+
+ create_table "open_source_projects", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.integer "commit_count", :default => 0
+ t.integer "code_line", :default => 0
+ t.integer "users_count", :default => 0
+ t.date "last_commit_time"
+ t.string "url"
+ t.date "date_collected"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "option_numbers", :force => true do |t|
+ t.integer "user_id"
+ t.integer "memo"
+ t.integer "messages_for_issues"
+ t.integer "issues_status"
+ t.integer "replay_for_message"
+ t.integer "replay_for_memo"
+ t.integer "follow"
+ t.integer "tread"
+ t.integer "praise_by_one"
+ t.integer "praise_by_two"
+ t.integer "praise_by_three"
+ t.integer "tread_by_one"
+ t.integer "tread_by_two"
+ t.integer "tread_by_three"
+ t.integer "changeset"
+ t.integer "document"
+ t.integer "attachment"
+ t.integer "issue_done_ratio"
+ t.integer "post_issue"
+ t.integer "score_type"
+ t.integer "total_score"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "project_id"
+ end
+
+ create_table "org_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "org_act_id"
+ t.string "org_act_type"
+ t.integer "container_id"
+ t.string "container_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_courses", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "course_id"
+ t.datetime "created_at"
+ end
+
+ create_table "org_document_comments", :force => true do |t|
+ t.text "title"
+ t.text "content"
+ t.integer "organization_id"
+ t.integer "creator_id"
+ t.integer "parent_id"
+ t.integer "reply_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.boolean "locked", :default => false
+ t.integer "sticky", :default => 0
+ t.integer "org_subfield_id"
+ t.integer "status", :default => 0
+ end
+
+ create_table "org_member_roles", :force => true do |t|
+ t.integer "org_member_id"
+ t.integer "role_id"
+ end
+
+ create_table "org_members", :force => true do |t|
+ t.integer "user_id"
+ t.integer "organization_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "sender_id"
+ t.integer "organization_id"
+ t.string "message_type"
+ t.integer "message_id"
+ t.integer "viewed"
+ t.string "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "status", :default => 0
+ end
+
+ create_table "org_projects", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "project_id"
+ t.datetime "created_at"
+ end
+
+ create_table "org_subfield_messages", :force => true do |t|
+ t.integer "org_subfield_id"
+ t.integer "message_id"
+ t.string "message_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_subfields", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "priority"
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "field_type"
+ t.integer "hide", :default => 0
+ t.integer "status", :default => 1
+ end
+
+ create_table "organizations", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.integer "creator_id"
+ t.integer "home_id"
+ t.boolean "is_public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.boolean "allow_guest_download", :default => true
+ t.integer "visits", :default => 0
+ t.integer "show_mode", :default => 0
+ t.integer "allow_teacher", :default => 0
+ end
+
+ create_table "permissions", :force => true do |t|
+ t.string "controller", :limit => 30, :default => "", :null => false
+ t.string "action", :limit => 30, :default => "", :null => false
+ t.string "description", :limit => 60, :default => "", :null => false
+ t.boolean "is_public", :default => false, :null => false
+ t.integer "sort", :default => 0, :null => false
+ t.boolean "mail_option", :default => false, :null => false
+ t.boolean "mail_enabled", :default => false, :null => false
+ end
+
+ create_table "permissions_roles", :id => false, :force => true do |t|
+ t.integer "permission_id", :default => 0, :null => false
+ t.integer "role_id", :default => 0, :null => false
+ end
+
+ add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
+
+ create_table "phone_app_versions", :force => true do |t|
+ t.string "version"
+ t.text "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_answers", :force => true do |t|
+ t.integer "poll_question_id"
+ t.text "answer_text"
+ t.integer "answer_position"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_questions", :force => true do |t|
+ t.string "question_title"
+ t.integer "question_type"
+ t.integer "is_necessary"
+ t.integer "poll_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "question_number"
+ end
+
+ create_table "poll_users", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_votes", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_question_id"
+ t.integer "poll_answer_id"
+ t.text "vote_text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "polls", :force => true do |t|
+ t.string "polls_name"
+ t.string "polls_type"
+ t.integer "polls_group_id"
+ t.integer "polls_status"
+ t.integer "user_id"
+ t.datetime "published_at"
+ t.datetime "closed_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "polls_description"
+ t.integer "show_result", :default => 1
+ end
+
+ create_table "praise_tread_caches", :force => true do |t|
+ t.integer "object_id", :null => false
+ t.string "object_type"
+ t.integer "praise_num"
+ t.integer "tread_num"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "praise_treads", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.integer "praise_tread_object_id"
+ t.string "praise_tread_object_type"
+ t.integer "praise_or_tread"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "principal_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "principal_id"
+ t.integer "principal_act_id"
+ t.string "principal_act_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "project_import_data", :force => true do |t|
+ t.integer "project_id"
+ t.text "data"
+ end
+
+ create_table "project_infos", :force => true do |t|
+ t.integer "project_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "project_scores", :force => true do |t|
+ t.string "project_id"
+ t.integer "score"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "issue_num", :default => 0
+ t.integer "issue_journal_num", :default => 0
+ t.integer "news_num", :default => 0
+ t.integer "documents_num", :default => 0
+ t.integer "changeset_num", :default => 0
+ t.integer "board_message_num", :default => 0
+ t.integer "board_num", :default => 0
+ t.integer "attach_num", :default => 0
+ t.datetime "commit_time"
+ end
+
+ create_table "project_statuses", :force => true do |t|
+ t.integer "changesets_count"
+ t.integer "watchers_count"
+ t.integer "project_id"
+ t.integer "project_type"
+ t.float "grade", :default => 0.0
+ t.integer "course_ac_para", :default => 0
+ end
+
+ add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
+
+ create_table "projecting_softapplictions", :force => true do |t|
+ t.integer "user_id"
+ t.integer "softapplication_id"
+ t.integer "project_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "projects", :force => true do |t|
+ t.string "name", :default => "", :null => false
+ t.text "description"
+ t.string "homepage", :default => ""
+ t.boolean "is_public", :default => true, :null => false
+ t.integer "parent_id"
+ t.datetime "created_on"
+ t.datetime "updated_on"
+ t.string "identifier"
+ t.integer "status", :default => 1, :null => false
+ t.integer "lft"
+ t.integer "rgt"
+ t.boolean "inherit_members", :default => false, :null => false
+ t.integer "project_type"
+ t.boolean "hidden_repo", :default => false, :null => false
+ t.integer "attachmenttype", :default => 1
+ t.integer "user_id"
+ t.integer "dts_test", :default => 0
+ t.string "enterprise_name"
+ t.integer "organization_id"
+ t.integer "project_new_type"
+ t.integer "gpid"
+ t.integer "forked_from_project_id"
+ t.integer "forked_count"
+ t.integer "commits_count", :default => 0
+ t.integer "publish_resource", :default => 0
+ t.integer "issues_count", :default => 0
+ t.integer "attachments_count", :default => 0
+ t.integer "boards_count", :default => 0
+ t.integer "news_count", :default => 0
+ t.integer "acts_count", :default => 0
+ t.integer "journals_count", :default => 0
+ t.integer "boards_reply_count", :default => 0
+ t.integer "visits", :default => 0
+ t.integer "hot", :default => 0
+ t.string "invite_code"
+ t.string "qrcode"
+ 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 "protected_branches", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.string "name", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "developers_can_push", :default => false, :null => false
+ end
+
+ add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
+
+ create_table "quality_analyses", :force => true do |t|
+ t.integer "project_id"
+ t.string "author_login"
+ t.string "rep_identifier"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "sonar_version", :default => 0
+ t.string "path"
+ t.string "branch"
+ t.string "language"
+ t.string "sonar_name"
+ end
+
+ 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 "rep_statics", :force => true do |t|
+ t.integer "project_id"
+ t.integer "commits_num"
+ t.string "uname"
+ t.string "email"
+ t.integer "add"
+ t.integer "del"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "changeset"
+ end
+
+ create_table "repositories", :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.string "url", :default => "", :null => false
+ t.string "login", :limit => 60, :default => ""
+ t.string "password", :default => ""
+ t.string "root_url", :default => ""
+ t.string "type"
+ t.string "path_encoding", :limit => 64
+ t.string "log_encoding", :limit => 64
+ t.text "extra_info"
+ t.string "identifier"
+ t.boolean "is_default", :default => false
+ t.boolean "hidden", :default => false
+ end
+
+ add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
+
+ create_table "rich_rich_files", :force => true do |t|
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "rich_file_file_name"
+ t.string "rich_file_content_type"
+ t.integer "rich_file_file_size"
+ t.datetime "rich_file_updated_at"
+ t.string "owner_type"
+ t.integer "owner_id"
+ t.text "uri_cache"
+ t.string "simplified_type", :default => "file"
+ end
+
+ create_table "roles", :force => true do |t|
+ t.string "name", :limit => 30, :default => "", :null => false
+ t.integer "position", :default => 1
+ t.boolean "assignable", :default => true
+ t.integer "builtin", :default => 0, :null => false
+ t.text "permissions"
+ t.string "issues_visibility", :limit => 30, :default => "default", :null => false
+ end
+
+ create_table "schools", :force => true do |t|
+ t.string "name"
+ t.string "province"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "logo_link"
+ t.string "pinyin"
+ t.integer "school_type", :default => 0
+ end
+
+ create_table "secdomains", :force => true do |t|
+ t.integer "sub_type"
+ t.string "subname"
+ t.integer "pid", :default => 0
+ t.string "desc"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "seems_rateable_cached_ratings", :force => true do |t|
+ t.integer "cacheable_id", :limit => 8
+ t.string "cacheable_type"
+ 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 "services", :force => true do |t|
+ t.string "type"
+ t.string "title"
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "active", :default => false, :null => false
+ t.text "properties"
+ t.boolean "template", :default => false
+ t.boolean "push_events", :default => true
+ t.boolean "issues_events", :default => true
+ t.boolean "merge_requests_events", :default => true
+ t.boolean "tag_push_events", :default => true
+ t.boolean "note_events", :default => true, :null => false
+ end
+
+ add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
+ add_index "services", ["project_id"], :name => "index_services_on_project_id"
+
+ create_table "settings", :force => true do |t|
+ t.string "name", :default => "", :null => false
+ t.text "value"
+ t.datetime "updated_on"
+ end
+
+ add_index "settings", ["name"], :name => "index_settings_on_name"
+
+ create_table "shares", :force => true do |t|
+ t.date "created_on"
+ t.string "url"
+ t.string "title"
+ t.integer "share_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "project_id"
+ t.integer "user_id"
+ t.string "description"
+ end
+
+ create_table "shield_activities", :force => true do |t|
+ t.string "container_type"
+ t.integer "container_id"
+ t.string "shield_type"
+ t.integer "shield_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "shield_wechat_messages", :force => true do |t|
+ t.integer "container_id"
+ t.string "container_type"
+ t.integer "shield_id"
+ t.string "shield_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "snippets", :force => true do |t|
+ t.string "title"
+ t.text "content", :limit => 2147483647
+ t.integer "author_id", :null => false
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "file_name"
+ t.datetime "expires_at"
+ t.string "type"
+ t.integer "visibility_level", :default => 0, :null => false
+ end
+
+ add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
+ add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
+ add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
+ add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
+ add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
+ add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
+
+ 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 "sonar_errors", :force => true do |t|
+ t.integer "project_id"
+ t.string "jenkins_job_name"
+ t.text "output"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "ssos", :force => true do |t|
+ t.integer "user_id"
+ t.string "openid"
+ t.string "name"
+ t.string "password"
+ t.string "email"
+ t.integer "sex"
+ t.string "school"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id"
+
+ create_table "student_work_projects", :force => true do |t|
+ t.integer "homework_common_id"
+ t.integer "student_work_id"
+ t.integer "project_id"
+ t.integer "user_id"
+ t.integer "is_leader"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id"
+ add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id"
+ add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id"
+ add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id"
+
+ create_table "student_work_tests", :force => true do |t|
+ t.integer "student_work_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "status", :default => 9
+ t.text "results"
+ t.text "src"
+ end
+
+ create_table "student_works", :force => true do |t|
+ t.string "name"
+ t.text "description", :limit => 2147483647
+ t.integer "homework_common_id"
+ t.integer "user_id"
+ t.float "final_score"
+ t.float "teacher_score"
+ t.float "student_score"
+ t.float "teaching_asistant_score"
+ t.integer "project_id", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "late_penalty", :default => 0
+ t.integer "absence_penalty", :default => 0
+ t.float "system_score", :default => 0.0
+ t.boolean "is_test", :default => false
+ t.float "work_score"
+ t.integer "simi_id"
+ t.integer "simi_value"
+ t.integer "work_status", :default => 0
+ end
+
+ add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
+
+ create_table "student_works_evaluation_distributions", :force => true do |t|
+ t.integer "student_work_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "student_works_scores", :force => true do |t|
+ t.integer "student_work_id"
+ t.integer "user_id"
+ t.integer "score"
+ t.text "comment"
+ t.integer "reviewer_role"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "students_for_courses", :force => true do |t|
+ t.integer "student_id"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
+ add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
+
+ create_table "sub_document_comments", :force => true do |t|
+ t.text "content"
+ t.text "title"
+ t.integer "sub_domain_id"
+ t.integer "creator_id"
+ t.integer "parent_id"
+ t.integer "reply_id"
+ t.integer "locked"
+ t.integer "sticky"
+ t.integer "org_subfield_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "sub_domains", :force => true do |t|
+ t.integer "org_subfield_id"
+ t.integer "priority"
+ t.string "name"
+ t.string "field_type"
+ t.integer "hide"
+ t.integer "status"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "subfield_subdomain_dirs", :force => true do |t|
+ t.integer "org_subfield_id"
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "subscriptions", :force => true do |t|
+ t.integer "user_id"
+ t.integer "subscribable_id"
+ t.string "subscribable_type"
+ t.boolean "subscribed"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
+
+ create_table "syllabuses", :force => true do |t|
+ t.string "title"
+ t.text "description"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "eng_name"
+ t.integer "syllabus_type"
+ t.integer "credit"
+ t.integer "hours"
+ t.integer "theory_hours"
+ t.integer "practice_hours"
+ t.string "applicable_major"
+ t.string "pre_course"
+ t.integer "visits", :default => 0
+ t.integer "des_status", :default => 0
+ end
+
+ add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
+
+ create_table "system_messages", :force => true do |t|
+ t.integer "user_id"
+ t.string "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "description"
+ t.string "subject"
+ end
+
+ create_table "taggings", :force => true do |t|
+ t.integer "tag_id"
+ t.integer "taggable_id"
+ t.string "taggable_type"
+ t.integer "tagger_id"
+ t.string "tagger_type"
+ t.string "context", :limit => 128
+ t.datetime "created_at"
+ end
+
+ add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
+ add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
+
+ create_table "tags", :force => true do |t|
+ t.string "name"
+ end
+
+ create_table "teachers", :force => true do |t|
+ t.string "tea_name"
+ t.string "location"
+ t.integer "couurse_time"
+ t.integer "course_code"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "extra"
+ end
+
+ create_table "time_entries", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.integer "user_id", :null => false
+ t.integer "issue_id"
+ t.float "hours", :null => false
+ t.string "comments"
+ t.integer "activity_id", :null => false
+ t.date "spent_on", :null => false
+ t.integer "tyear", :null => false
+ t.integer "tmonth", :null => false
+ t.integer "tweek", :null => false
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ end
+
+ add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id"
+ add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on"
+ add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
+ add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
+ add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
+
+ create_table "tokens", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.string "action", :limit => 30, :default => "", :null => false
+ t.string "value", :limit => 40, :default => "", :null => false
+ t.datetime "created_on", :null => false
+ end
+
+ add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
+ add_index "tokens", ["value"], :name => "tokens_value", :unique => true
+
+ create_table "trackers", :force => true do |t|
+ t.string "name", :limit => 30, :default => "", :null => false
+ t.boolean "is_in_chlog", :default => false, :null => false
+ t.integer "position", :default => 1
+ t.boolean "is_in_roadmap", :default => true, :null => false
+ t.integer "fields_bits", :default => 0
+ end
+
+ create_table "user_actions", :force => true do |t|
+ t.integer "user_id"
+ t.string "action_type"
+ t.integer "action_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "user_activities", :force => true do |t|
+ t.string "act_type"
+ t.integer "act_id"
+ t.string "container_type"
+ t.integer "container_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "user_id"
+ end
+
+ add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index"
+
+ create_table "user_extensions", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.date "birthday"
+ t.string "brief_introduction"
+ t.integer "gender"
+ t.string "location"
+ t.string "occupation"
+ t.integer "work_experience"
+ t.integer "zip_code"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "technical_title"
+ t.integer "identity"
+ t.string "student_id"
+ t.string "teacher_realname"
+ t.string "student_realname"
+ t.string "location_city"
+ t.integer "school_id"
+ t.string "description", :default => ""
+ end
+
+ create_table "user_feedback_messages", :force => true do |t|
+ t.integer "user_id"
+ t.integer "journals_for_message_id"
+ t.string "journals_for_message_type"
+ t.integer "viewed"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id"
+ add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at"
+
+ create_table "user_grades", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.integer "project_id", :null => false
+ t.float "grade", :default => 0.0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade"
+ add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
+ add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
+
+ create_table "user_levels", :force => true do |t|
+ t.integer "user_id"
+ t.integer "level"
+ end
+
+ create_table "user_preferences", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.text "others"
+ t.boolean "hide_mail", :default => false
+ t.string "time_zone"
+ end
+
+ add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
+
+ create_table "user_score_details", :force => true do |t|
+ t.integer "current_user_id"
+ t.integer "target_user_id"
+ t.string "score_type"
+ t.string "score_action"
+ t.integer "user_id"
+ t.integer "old_score"
+ t.integer "new_score"
+ t.integer "current_user_level"
+ t.integer "target_user_level"
+ t.integer "score_changeable_obj_id"
+ t.string "score_changeable_obj_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "user_scores", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.integer "collaboration"
+ t.integer "influence"
+ t.integer "skill"
+ t.integer "active"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "user_statuses", :force => true do |t|
+ t.integer "changesets_count"
+ t.integer "watchers_count"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.float "grade", :default => 0.0
+ end
+
+ add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
+ add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
+ add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
+
+ create_table "user_wechats", :force => true do |t|
+ t.integer "subscribe"
+ t.string "openid"
+ t.string "nickname"
+ t.integer "sex"
+ t.string "language"
+ t.string "city"
+ t.string "province"
+ t.string "country"
+ t.string "headimgurl"
+ t.string "subscribe_time"
+ t.string "unionid"
+ t.string "remark"
+ t.integer "groupid"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "users", :force => true do |t|
+ t.string "login", :default => "", :null => false
+ t.string "hashed_password", :limit => 40, :default => "", :null => false
+ t.string "firstname", :limit => 30, :default => "", :null => false
+ t.string "lastname", :default => "", :null => false
+ t.string "mail", :limit => 60, :default => "", :null => false
+ t.boolean "admin", :default => false, :null => false
+ t.integer "status", :default => 1, :null => false
+ t.datetime "last_login_on"
+ t.string "language", :limit => 5, :default => ""
+ t.integer "auth_source_id"
+ t.datetime "created_on"
+ t.datetime "updated_on"
+ t.string "type"
+ t.string "identity_url"
+ t.string "mail_notification", :default => "", :null => false
+ t.string "salt", :limit => 64
+ t.integer "gid"
+ t.integer "visits", :default => 0
+ t.integer "excellent_teacher", :default => 0
+ t.integer "excellent_student", :default => 0
+ 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 "users_star_projects", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.integer "user_id", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
+ add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
+ add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
+
+ create_table "versions", :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.string "name", :default => "", :null => false
+ t.string "description", :default => ""
+ t.date "effective_date"
+ t.datetime "created_on"
+ t.datetime "updated_on"
+ t.string "wiki_page_title"
+ t.string "status", :default => "open"
+ t.string "sharing", :default => "none", :null => false
+ end
+
+ add_index "versions", ["project_id"], :name => "versions_project_id"
+ add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
+
+ create_table "visitors", :force => true do |t|
+ t.integer "user_id"
+ t.integer "master_id"
+ t.datetime "updated_on"
+ t.datetime "created_on"
+ end
+
+ add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
+ add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
+ add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
+
+ create_table "watchers", :force => true do |t|
+ t.string "watchable_type", :default => "", :null => false
+ t.integer "watchable_id", :default => 0, :null => false
+ t.integer "user_id"
+ end
+
+ add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type"
+ add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
+ add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
+
+ create_table "web_footer_companies", :force => true do |t|
+ t.string "name"
+ t.string "logo_size"
+ t.string "url"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "web_footer_oranizers", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "web_hooks", :force => true do |t|
+ t.string "url"
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "type", :default => "ProjectHook"
+ t.integer "service_id"
+ t.boolean "push_events", :default => true, :null => false
+ t.boolean "issues_events", :default => false, :null => false
+ t.boolean "merge_requests_events", :default => false, :null => false
+ t.boolean "tag_push_events", :default => false
+ t.boolean "note_events", :default => false, :null => false
+ end
+
+ add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
+ add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
+
+ create_table "wechat_logs", :force => true do |t|
+ t.string "openid", :null => false
+ t.text "request_raw"
+ t.text "response_raw"
+ t.text "session_raw"
+ t.datetime "created_at", :null => false
+ end
+
+ add_index "wechat_logs", ["openid"], :name => "index_wechat_logs_on_openid"
+
+ 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
diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html
index 74af26cfe..43640a115 100644
--- a/public/assets/wechat/app.html
+++ b/public/assets/wechat/app.html
@@ -36,7 +36,7 @@
-
+
diff --git a/public/assets/wechat/edit_class.html b/public/assets/wechat/edit_class.html
index 62022566b..68b84aee6 100644
--- a/public/assets/wechat/edit_class.html
+++ b/public/assets/wechat/edit_class.html
@@ -3,9 +3,9 @@
管理课程
diff --git a/public/assets/wechat/new_project.html b/public/assets/wechat/new_project.html
index 785de322f..9ef19fad9 100644
--- a/public/assets/wechat/new_project.html
+++ b/public/assets/wechat/new_project.html
@@ -5,7 +5,7 @@