diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9e935ae40..68386de44 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -461,8 +461,8 @@ class AdminController < ApplicationController scope = User.order('last_login_on desc') scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present? scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present? - @user = scope - @user = paginateHelper @user,30 + @users = scope + @users = paginateHelper @users,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbf2c30bb..d6470ce51 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -312,7 +312,8 @@ class ApplicationController < ActionController::Base elsif @course allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global) else - allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global) + # allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global) + allowed = true end allowed end @@ -769,6 +770,7 @@ class ApplicationController < ActionController::Base end def api_request? + return false if params[:controller] == 'at' %w(xml json).include? params[:format] end diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 25e731754..456306c64 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -34,6 +34,12 @@ class AtController < ApplicationController find_homework(id) when 'Topic' find_topic(id) + when 'JournalsForMessage' + find_journals_for_message(id) + when 'Principal' + find_principal(id) + when 'All' + nil else nil end @@ -120,7 +126,11 @@ class AtController < ApplicationController #JournalsForMessage def find_journals_for_message(id) jounrnal = JournalsForMessage.find(id) - find_at_users(jounrnal.jour_type, jounrnal.jour_id) + if jounrnal.jour_type == 'Principal' + [jounrnal.user] + (JournalsForMessage.where(m_reply_id: id).map(&:user) || []) + else + find_at_users(jounrnal.jour_type, jounrnal.jour_id) + end end #Poll @@ -129,8 +139,6 @@ class AtController < ApplicationController #Journal def find_journal(id) - journal = Journal.find(id) - find_at_users(journal.journalized_type, journal.journalized_id) end #Document @@ -145,7 +153,6 @@ class AtController < ApplicationController #Principal def find_principal(id) - end #BlogComment diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 23fe19333..cf4e6a8e9 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -74,6 +74,45 @@ class AttachmentsController < ApplicationController :disposition => 'attachment' #inline can open in browser end + def direct_download_history + @attachment_history = AttachmentHistory.find(params[:id]) + @attachment_history.increment_download + send_file @attachment_history.diskfile_history, :filename => filename_for_content_disposition(@attachment_history.filename), + :type => detect_content_type(@attachment_history), + :disposition => 'attachment' #inline can open in browser + end + + def download_history + @attachment_history = AttachmentHistory.find(params[:id]) + candown = attachment_history_candown @attachment_history + if candown || User.current.admin? || User.current.id == @attachment_history.author_id + if stale?(:etag => @attachment_history.digest) + if params[:preview] == 'true' + convered_file = @attachment_history.diskfile_history + #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化 + unless pdf?(convered_file) + convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") + unless File.exist?(convered_file) + office = Trustie::Utils::Office.new(@attachment_history.diskfile) + office.conver(convered_file) + end + end + if File.exist?(convered_file) && pdf?(convered_file) + send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline' + else + direct_download_history + end + else + direct_download_history + end + end + else + render_403 :message => :notice_not_authorized + end + rescue => e + redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html" + end + def download # modify by nwb # 下载添加权限设置 @@ -212,7 +251,7 @@ class AttachmentsController < ApplicationController @history.version = @old_history.nil? ? 1 : @old_history.version + 1 @history.save #历史记录保存完毕 #将最新保存的记录 数据替换到 需要修改的文件记录 - @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public") + @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads") @old_attachment.save #删除当前记录 @attachment.delete diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index ae6aff794..f5e3314bb 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController render_attachment_warning_if_needed(@article) else end - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if params[:in_act] + redirect_to user_path(params[:user_id]) else - redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) + if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id) + redirect_to user_path(params[:user_id]) + else + redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) + end end end def destroy @@ -123,6 +127,7 @@ class BlogCommentsController < ApplicationController @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment @article.save + # @article.update_attribute(:updated_on, @blogComment.updated_on) @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 0202224ed..842433ec6 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -2,7 +2,6 @@ class BlogsController < ApplicationController before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage] before_filter :find_user def index - @articls = @user.blog.articles @article = BlogComment.new respond_to do |format| format.html {render :layout=>'new_base_user'} diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..36060d41c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -321,11 +321,12 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") + @homeworks = @course.homework_commons.order("created_at desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; respond_to do |format| format.xls { - send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", + send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition("#{filename}.xls")) } end @@ -441,7 +442,14 @@ class CoursesController < ApplicationController @course = cs.create_course(params,User.current)[:course] if params[:copy_course] copy_course = Course.find params[:copy_course].to_i - @course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) + @course.is_copy = params[:copy_course].to_i + @course.open_student = copy_course.open_student + @course.publish_resource = copy_course.publish_resource + @course.save + + #copy avatar + copy_avatar(@course, copy_course) + if params[:checkAll] attachments = copy_course.attachments attachments.each do |attachment| @@ -903,6 +911,17 @@ class CoursesController < ApplicationController return 404 end end + #搜索作业 + def homework_search + @search = "%#{params[:search].strip.downcase}%" + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + @page = params[:page] ? params[:page].to_i + 1 : 0 + if @is_teacher + @homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end + end private def update_quotes attachment @@ -960,7 +979,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -972,7 +991,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -1006,16 +1025,54 @@ class CoursesController < ApplicationController end - def member_to_xls members,groups + def member_to_xls homeworks, course, members,groups xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "student" - blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 - sheet1.row(0).default_format = blue + #sheet1.row(0).default_format = blue + #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)]) + sheet1[0,0] = "课程编号" + sheet1[0,1] = course.id + sheet1[1,0] = "课程学期" + sheet1[1,1] = course.time.to_s+"年"+course.term + sheet1[2,0] = "课程名称" + sheet1[2,1] = course.name + sheet1[3,0] = "教师团队" + sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、') + sheet1[4,0] = "主讲教师" + sheet1[4,1] = course.teacher.show_name + sheet1[5,0] = "排名" + sheet1[5,1] = "学生姓名" + sheet1[5,2] = "昵称" + sheet1[5,3] = "学号" + for i in 0 ... homeworks.count + sheet1[5,i+4] = "第"+(i+1).to_s+"次" + end + sheet1[5,homeworks.count+4] = "总成绩" + sheet1[5,0] = "排名" + sheet1[5,0] = "排名" + count_row = 6 + members.each_with_index do |member, i| + sheet1[count_row,0]= i+1 + sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s + sheet1[count_row,2] = member.user.login + sheet1[count_row,3] = member.user.user_extensions.student_id + homeworks.each_with_index do |homework, j| + student_works = homework.student_works.where("user_id = #{member.user.id}") + if student_works.empty? + sheet1[count_row,j+4] = format("%0.2f",0) + else + final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score + score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty + sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score) + end + end + sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s) + count_row += 1 + end - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_score)]) - count_row = 1 +=begin group0 = CourseGroup.new(); group0.id = 0; group0.name = l(:excel_member_with_out_class) @@ -1037,6 +1094,7 @@ class CoursesController < ApplicationController end end end +=end book.write xls_report xls_report.string end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d345fba5f..a891d3354 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController @new_homework.homework_detail_manual = HomeworkDetailManual.new @new_homework.course = @course @page = params[:page] ? params[:page].to_i + 1 : 0 - @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + if @is_teacher + @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) + else + @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) + end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] @@ -340,7 +344,7 @@ class HomeworkCommonController < ApplicationController #当前用户是不是课程的成员 def member_of_course - render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin? + render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 72dd0a741..eb78c4c5b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,7 +81,7 @@ class IssuesController < ApplicationController @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] - @done_ratio = parmas[:done_ratio] + @done_ratio = params[:done_ratio] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @@ -222,7 +222,7 @@ class IssuesController < ApplicationController def update if params[:issue_detail] - issue = Issue.find(params[:issue_id]) + issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) @saved = update_user_issue_detail(issue, params) return diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index d051a91f7..bae0232a5 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -109,7 +109,8 @@ class OrgSubfieldsController < ApplicationController if SubfieldSubdomainDir.find_by_sql(sql).count == 0 if @org_subfield.subfield_subdomain_dir @sub_dir = @org_subfield.subfield_subdomain_dir - @sub_dir.update_attribute(:name, params[:sub_dir_name]) + @sub_dir = SubfieldSubdomainDir.update(@sub_dir.id, :name => params[:sub_dir_name]) + #@sub_dir.update_attribute(:name, params[:sub_dir_name]) else @sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name]) end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 361303833..6e2da311f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -55,6 +55,7 @@ class OrganizationsController < ApplicationController @organization.name = params[:organization][:name] @organization.description = params[:organization][:description] @organization.is_public = params[:organization][:is_public] + @organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) @@ -301,7 +302,7 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @subfield = @org.org_subfields.where("field_type = 'Post'") else @subfield = @org.org_subfields.where('field_type = "Resource" ') diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 78babc43c..1d7b4117d 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -214,6 +214,7 @@ class PollController < ApplicationController def publish_poll @poll.polls_status = 2 @poll.published_at = Time.now + @poll.show_result = params[:show_result] if @poll.save if params[:is_remote] redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cafec1c62..707e87fd1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -360,6 +360,9 @@ update end # end @changesets_latest_coimmit = @changesets[0] + unless @changesets[0].blank? + update_commits_date(@project, @changesets_latest_coimmit) + end @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] @@ -589,6 +592,11 @@ update project.project_score.update_attribute(:changeset_num, count) end + # 更新项目提交次数时间 + def update_commits_date project, date + project.project_score.update_attribute(:commit_time, date.created_at) + end + def find_repository @repository = Repository.find(params[:id]) @project = @repository.project diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d785a608a..9eabc95f2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -192,11 +192,13 @@ class UsersController < ApplicationController forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0) + org_querys = OrgMessage.where("user_id=? and viewed=0", user) if User.current.id == @user.id course_querys.update_all(:viewed => true) forge_querys.update_all(:viewed => true) user_querys.update_all(:viewed => true) forum_querys.update_all(:viewed => true) + org_querys.update_all(:viewed => true) end end @@ -403,8 +405,47 @@ class UsersController < ApplicationController #导入作业 def user_import_homeworks + @user = User.current @select_course = params[:select_course] ? 1 : 0 - @user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 + respond_to do |format| + format.js + end + end + + def user_homework_type + @user = User.current + if(params[:type].blank? || params[:type] == "1") #公共题库 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + elsif params[:type] == "2" #我的题库 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") + end + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 + respond_to do |format| + format.js + end + end + + def show_homework_detail + @homework = HomeworkCommon.find params[:homework].to_i respond_to do |format| format.js end @@ -412,7 +453,22 @@ class UsersController < ApplicationController #用户主页过滤作业 def user_search_homeworks - @user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc") + @user = User.current + search = params[:name].to_s.strip.downcase + if(params[:type].blank? || params[:type] == "1") #全部 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc") + elsif params[:type] == "2" #课程资源 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc") + end + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 respond_to do |format| format.js end @@ -426,6 +482,7 @@ class UsersController < ApplicationController @homework = HomeworkCommon.new @select_course = params[:select_course] || 0 if homework + @ref_homework = homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time @@ -583,13 +640,15 @@ class UsersController < ApplicationController homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing homework_detail_group.save if homework_detail_group - + if params[:quotes] && !params[:quotes].blank? + homework = HomeworkCommon.find params[:quotes].to_i + homework.update_attribute(:quotes, homework.quotes+1) + end if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) else redirect_to user_homeworks_user_path(User.current.id) end - end end else @@ -755,23 +814,17 @@ class UsersController < ApplicationController if params[:type].present? case params[:type] when "public" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC') when "private" - jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC') else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end else - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour_count = jours.count - @jour = jours.limit(10).offset(@page * 10) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC') end + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) @@ -1633,6 +1686,10 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, + Project.find(project_id).project_score.attach_num + 1) + end end end elsif params[:send_ids].present? @@ -1668,6 +1725,9 @@ class UsersController < ApplicationController attach_copied_obj.attachtype = 1 end attach_copied_obj.save + unless Project.find(project_id).project_score.nil? + Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) + end end end end @@ -1797,12 +1857,13 @@ class UsersController < ApplicationController news = News.find(params[:send_id]) project_ids = params[:project_ids] project_ids.each do |project_id| - if Project.find(project_id).news.map(&:id).exclude?(news.id) - project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) + project = Project.find(project_id) + if project.news.map(&:id).exclude?(news.id) + message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id) news.attachments.each do |attach| - project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, - :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, - :is_public => attach.is_public, :quotes => 0) + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) end end end @@ -1820,6 +1881,53 @@ class UsersController < ApplicationController OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) end + def share_message_to_course + @message = Message.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + course = Course.find(course_id) + if course.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_project + @message = Message.find(params[:send_id]) + project_ids = params[:project_ids] + project_ids.each do |project_id| + project = Project.find(project_id) + if project.news.map(&:id).exclude?(@message.id) + message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_message_to_org + field_id = params[:subfield] + @message = Message.find(params[:send_id]) + @message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1) + @message.save + board = OrgSubfield.find(field_id).boards.first + mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + @message.attachments.each do |attach| + mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id) + end + def change_org_subfield end @@ -2061,9 +2169,9 @@ class UsersController < ApplicationController end elsif params[:type] == "4" #附件 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") end elsif params[:type] == "5" #用户资源 if User.current.id.to_i == params[:id].to_i @@ -2169,7 +2277,7 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - if params[:send_type].present? and params[:send_type] == 'news' + if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message') @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} else @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 8115f3f91..351be4e64 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -62,6 +62,7 @@ class WordsController < ApplicationController update_forge_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id) + (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) end respond_to do |format| # format.html { @@ -73,9 +74,9 @@ class WordsController < ApplicationController # render 'test/index' # } format.js { - @reply_type = params[:reply_type] @user_activity_id = params[:user_activity_id] @activity = JournalsForMessage.find(parent_id) + @is_activity = params[:is_activity] } end @@ -94,6 +95,9 @@ class WordsController < ApplicationController @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @is_user = true + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_activity = params[:is_activity].to_i if params[:is_activity] + @activity = @journal_destroyed.parent if @journal_destroyed.parent elsif @journal_destroyed.jour_type == 'HomeworkCommon' @homework = HomeworkCommon.find @journal_destroyed.jour_id if params[:user_activity_id] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 51138f2ef..9d08be378 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,11 @@ module ApplicationHelper end end + def link_to_user_version(version, options = {}) + return '' unless version && version.is_a?(Version) + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue" + end + # 判断课程是否为精品课程 def is_excellent_course course (course.is_excellent? or course.excellent_option?) ? true : false @@ -62,7 +67,7 @@ module ApplicationHelper # 获取项目/课程总分 # 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分 def static_project_score obj - score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 + score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5 end # 获取组织成员中文名字 @@ -1992,6 +1997,18 @@ module ApplicationHelper courses_doing end + def attachment_history_candown attachment_history + if attachment_history.container_type == "Course" + course = Course.find(attachment_history.container_id) + candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1) + elsif attachment_history.container_type == "Project" + project = Project.find(attachment_history.container_id) + candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1) + elsif attachment_history.container_type == "OrgSubfield" + org = OrgSubfield.find(attachment_history.container_id) + candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1) + end + end def attachment_candown attachment candown = false @@ -2803,7 +2820,7 @@ int main(int argc, char** argv){ end if opt[:init_activity] - ss += javascript_include_tag "init_activity_KindEditor" + ss += javascript_include_tag "create_kindeditor" end ss.html_safe diff --git a/app/helpers/avatar_helper.rb b/app/helpers/avatar_helper.rb index 3f6802f59..0291d177f 100644 --- a/app/helpers/avatar_helper.rb +++ b/app/helpers/avatar_helper.rb @@ -1,9 +1,24 @@ module AvatarHelper AVATAR_SIZE="50x50" + + def copy_avatar(des, src) + src_file = disk_filename(src.class,src.id) + des_file = disk_filename(des.class,des.id) + + FileUtils.cp(src_file, des_file) if File.exist?(src_file) + end - def avatar_image(source) - File.join(relative_path, avatar_directory(source.class), source.id.to_s) + def avatar_image(source, copyed=false) + source_type = source.class + source_id = source.id + + course = Course.find(source_id) rescue nil + if course && copyed + source_id = course.is_copy + end + + File.join(relative_path, avatar_directory(source_type), source_id.to_s) end def relative_path @@ -23,7 +38,18 @@ module AvatarHelper end def disk_filename(source_type,source_id,image_file=nil) - File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file)) + end + + def copy_course?(source_type, source_id) + file= disk_filename(source_type, source_id) + if source_type == Course && !File.exist?(file) + course = Course.find(source_id) rescue nil + if course && course.is_copy>0 + return true + end + end + false end def file_extension(filename=nil) @@ -35,7 +61,9 @@ module AvatarHelper return File.join(relative_path,'AnonymousUser','0') end if source.class && source.id && File.exist?(disk_filename(source.class,source.id)) - avatar_image(source) + avatar_image(source, false) + elsif copy_course?(source.class, source.id) + avatar_image(source, true) else File.join(relative_path,avatar_directory(source.class),'0') end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index fb7214fce..40ed4a21a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -35,14 +35,29 @@ module CoursesHelper # a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)} # 通过elastic结果获取精品课程 a_courses = [] - courses = Course.search(keywords) - courses.each do |c| - a_courses << c.id - end + #courses = Course.search(keywords) + #courses.each do |c| + # a_courses << c.id + #end a_courses << a_tags unless a_tags.length == 0 + # 课程本身不能搜索显示自己 + excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id} + limit = 5 - excellent_ids.length.to_i + sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id + and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;" + default_ecourse_ids = Course.find_by_sql(sql).flatten + # REDO:时间紧,待优化 + default_ids =[] + default_ecourse_ids.each do |de| + default_ids << de.id + end + default_ids = default_ids - excellent_ids + #default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten + arr_result = excellent_ids << default_ids + arr_result = arr_result.flatten.first(5) + return arr_result # 过滤条件:精品课程、本身不在搜索范围 - e_courses = Course.where("is_excellent =? and id in (?)",1,a_courses.flatten.uniq).where("id !=?",current_course.id) - e_courses + #e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id) end # 判断精品课程是否可见,非课程成员无法查看私有课程 @@ -101,6 +116,34 @@ module CoursesHelper @course.journals_for_messages.where('m_parent_id IS NULL').count end + #当前学期 + def current_time_and_term course + str = "" + term = cur_course_term + if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year + str = course.time.to_s + course.term.to_s + elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term) + str = course.time.to_s + course.term.to_s + elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term)) + str = course.end_time.to_s + course.end_term.to_s + else + str = Time.now.year.to_s + cur_course_term.to_s + end + str + end + + def set_term_value term + val = 0 + if term == "春季学期" + val = 1 + elsif term == "夏季学期" + val = 2 + elsif term == "秋季学期" + val = 3 + end + val + end + # 返回学生数量,即roles表中定义的Reporter #def studentCount project # searchStudent(project).count @@ -547,7 +590,7 @@ module CoursesHelper type = [] month = Time.now.month now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year) - year = month < 3 && now_year >=Time.now.year ? now_year - 1 : now_year + year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year for i in (year..year + 10) option = [] option << i @@ -577,8 +620,10 @@ module CoursesHelper def cur_course_term month = Time.now.month - if month >= 9 || month < 3 + if month >= 9 || month < 2 term = "秋季学期" + elsif (month >= 7 && Time.now.day >= 15) || month == 8 + term = "夏季学期" else term = "春季学期" end @@ -588,7 +633,7 @@ module CoursesHelper def course_in_current_or_next_term course is_current_term = false is_next_term = false - year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year + year_now = Time.now.month < 2 ? Time.now.year - 1:Time.now.year if course.time == year_now && course.term == cur_course_term is_current_term = true end @@ -597,6 +642,7 @@ module CoursesHelper elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期" is_next_term = true elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期" + is_next_term = true end is_current_term || is_next_term end @@ -682,17 +728,16 @@ module CoursesHelper def join_in_course_header(course, user, options=[]) if user.logged? joined = course.members.map{|member| member.user_id}.include? user.id - text = joined ? ("".html_safe + l(:label_course_exit_student)) : ("".html_safe + l(:label_course_join_student)) + text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link = "#{l(:label_course_join_student)}" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) + link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) else - link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "#{l(:label_course_exit_student)}".html_safe + link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") end else - link = "#{l(:label_course_join_student)}" + - "#{l(:label_course_exit_student)}" + link = "#{l(:label_course_join_student)}" end link.html_safe end @@ -781,7 +826,7 @@ module CoursesHelper # 学生按作业总分排序,取前8个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{course.id} diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 43ef7cefc..4edfed578 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -85,19 +85,15 @@ module UsersHelper end end - def link_to_user_version(version, options = {}) - return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " - end - # 统计未读消息数 def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count + org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count at_count = user.at_messages.where(viewed: false).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count end def user_mail_notification_options(user) diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 3d20ffafb..bca2c7ba4 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -47,7 +47,11 @@ class AtMessage < ActiveRecord::Base "回复帖子: " end + at_message.subject when 'JournalsForMessage' - "作业: #{at_message.jour.name} 中留言" + if at_message.jour_type == 'Principal' + "留言: 在#{at_message.at_user.show_name}主页中留言" + else + "作业: #{at_message.jour.name} 中留言" + end else logger.error "error type: #{at_message_type}" end @@ -92,7 +96,12 @@ class AtMessage < ActiveRecord::Base when 'Message' {controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board} when 'JournalsForMessage' - {controller: :homework_common, action: :index, course: at_message.jour.course_id} + if at_message.jour_type == 'Principal' + {controller: :users, action: :user_messages, id: at_message.at_user} + else + {controller: :homework_common, action: :index, course: at_message.jour.course_id} + end + else logger.error "error type: #{at_message_type}" end diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb index 2160d242d..fb4e762ba 100644 --- a/app/models/attachment_history.rb +++ b/app/models/attachment_history.rb @@ -1,3 +1,14 @@ class AttachmentHistory < ActiveRecord::Base belongs_to :attachment,foreign_key: 'attachment_id' + cattr_accessor :storage_history_path + @@storage_history_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files") + + # Returns file's location on disk + def diskfile_history + File.join(self.class.storage_history_path, disk_directory.to_s, disk_filename.to_s) + end + + def increment_download + increment!(:downloads) + end end diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index db28e55d6..2b31af604 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity after_update :update_activity + after_create :update_parent_time before_destroy :destroy_user_activity scope :like, lambda {|arg| @@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base (user && user.logged? && (self.author == user) ) || user.admin? end + def update_parent_time + if !self.parent.nil? + self.root.update_attribute(:updated_on, self.updated_on) + end + end def project end end diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 194e1183a..c9c6cec4b 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -72,7 +72,7 @@ class CourseActivity < ActiveRecord::Base # message的status状态为0为正常,为1表示创建课程时发送的message message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 - message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) + message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first end end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 9e0ce2dd2..cdcf9d19e 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :reset_counters! - after_update :update_ativity + #after_update :update_activity after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ee37927d3..05b0349ec 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -380,7 +380,15 @@ class Mailer < ActionMailer::Base end # issue截止时间提醒 - def issue_due_date(issue, recipients) + def issue_due_date(issue) + recipients ||= [] + if issue.author.id != issue.assigned_to_id + recipients << issue.author.mail + end + + # 被指派人邮箱地址加入数组 + recipients << issue.assigned_to.mail + # cc = wiki_content.page.wiki.watcher_recipients - recipients @author = issue.author @issue_name = issue.subject @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) diff --git a/app/models/member.rb b/app/models/member.rb index ed7ee81e6..413fedc07 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -150,7 +150,7 @@ class Member < ActiveRecord::Base #当前学生在指定作业内的得分 def homework_common_score homework_common - StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) + StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) end def student_work_score_avg @@ -158,7 +158,12 @@ class Member < ActiveRecord::Base end def student_work_score_sum - StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f + sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = #{self.course_id} + AND student_works.user_id = #{self.user_id}" + score = StudentWork.find_by_sql(sql_select) end protected diff --git a/app/models/secdomain.rb b/app/models/secdomain.rb new file mode 100644 index 000000000..4d0abe5db --- /dev/null +++ b/app/models/secdomain.rb @@ -0,0 +1,18 @@ +class Secdomain < ActiveRecord::Base + attr_accessible :pid, :subname, :sub_type, :desc + + validates_presence_of :subname, :sub_type + validates_uniqueness_of :subname + + def controller + return 'organizations' if sub_type == 2 + return 'users' if sub_type == 3 + nil + end + + def action + return 'show' if sub_type == 2 + return 'show' if sub_type == 3 + nil + end +end diff --git a/app/models/subfield_subdomain_dir.rb b/app/models/subfield_subdomain_dir.rb index 9897e19ac..2ec93fe05 100644 --- a/app/models/subfield_subdomain_dir.rb +++ b/app/models/subfield_subdomain_dir.rb @@ -1,4 +1,5 @@ class SubfieldSubdomainDir < ActiveRecord::Base # attr_accessible :title, :body belongs_to :org_subfield + validates_exclusion_of :name, :in => %w(setting members org_document_comments) end diff --git a/app/models/user.rb b/app/models/user.rb index f3367db59..a74c20751 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -345,7 +345,8 @@ class User < Principal user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count end # 查询指派给我的缺陷记录 @@ -825,6 +826,9 @@ class User < Principal end def admin_of_org?(org) + if self.admin? + return true + end if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0 return false end diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index a32bdd33a..594f554b4 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -47,7 +47,7 @@ <% @count=@page * 30 %> - <% for user in @user do %> + <% for user in @users do %> <% @count +=1 %> diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb index c1a6464e8..9dc700123 100644 --- a/app/views/attachments/_show_attachment_history.html.erb +++ b/app/views/attachments/_show_attachment_history.html.erb @@ -14,7 +14,9 @@
<% @attachment_histories.each do |history| %> - + <%= link_to truncate(history.filename,length: 35, omission: '...'), + download_history_attachment_path(history.id, history.filename), + :title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> 版本号:<%= history.version %> diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb index 4f3bf41c3..a5bb6672b 100644 --- a/app/views/attachments/attachment_versions.js.erb +++ b/app/views/attachments/attachment_versions.js.erb @@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').parent().css("top","40%").css("left","50%"); $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb index 61669058b..292587cad 100644 --- a/app/views/blog_comments/_simple_ke_reply_form.html.erb +++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb @@ -21,8 +21,8 @@ <% end %> +
-

diff --git a/app/views/blog_comments/edit.html.erb b/app/views/blog_comments/edit.html.erb index 43a8aae92..704342fc0 100644 --- a/app/views/blog_comments/edit.html.erb +++ b/app/views/blog_comments/edit.html.erb @@ -1,5 +1,5 @@ <% if User.current.logged? && User.current.id == @user.id %> - <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT', + <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> <% end %> diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb index cd53707d5..9bd226ce1 100644 --- a/app/views/blog_comments/quote.js.erb +++ b/app/views/blog_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>"); + sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @blogComment.id%>").length >0) { $("#reply_to_message_<%= @blogComment.id%>").replaceWith("

"); diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 2a4e71f1c..915ab892d 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -5,4 +5,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); //init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); \ No newline at end of file diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 6f4397569..c80274db4 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -1,6 +1,7 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor",'blog' %> + <%#= javascript_include_tag "init_activity_KindEditor",'blog' %> + <%= javascript_include_tag "create_kindeditor",'blog' %> <% end %> @@ -45,7 +46,7 @@
  • <%= link_to( l(:button_edit), - {:action => 'edit', :id => @article.id}, + {:action => 'edit', :id => @article.id,:in_act => params[:in_act]}, :class => 'postOptionLink' ) if User.current && User.current.id == @article.author.id %>
  • @@ -94,7 +95,7 @@
    <%= format_time( @article.created_on)%>
    -
    +
    <%= @article.content.html_safe%>
    @@ -208,4 +209,11 @@
    <% end %> - \ No newline at end of file + + diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 4ca86e7ae..05f69055f 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -198,8 +198,8 @@ +
    -

    diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb index ca85c0ba2..f3fd1aa61 100644 --- a/app/views/blogs/_article_list.html.erb +++ b/app/views/blogs/_article_list.html.erb @@ -1,19 +1,19 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> <% if topic %> diff --git a/app/views/blogs/index.html.erb b/app/views/blogs/index.html.erb index 8128cd088..35bc1cd7e 100644 --- a/app/views/blogs/index.html.erb +++ b/app/views/blogs/index.html.erb @@ -30,7 +30,7 @@ <%= import_ke(enable_at: false, prettify: false) %> -<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %> +<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.updated_on desc"), :page => 0, :user => @user} %> <% if topic %> diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb index 367f0552c..1d5cc3b75 100644 --- a/app/views/boards/_project_show_detail.html.erb +++ b/app/views/boards/_project_show_detail.html.erb @@ -1,18 +1,18 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> <% if topics%> <% topics.each do |topic| %> @@ -39,7 +39,7 @@ } $(function () { - init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); + sd_create_editor_from_data(<%= topic.id%>, null, "100%"); }); <% if topic %> diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index f94eda065..0814b5f50 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -5,4 +5,4 @@ <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); <% end %> -init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity"); +sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity"); diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index a759946f6..c7547adcd 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -39,12 +39,13 @@
  • - <%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%> + <%= image_tag(url_to_avatar(@course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
  • + diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 1b0d5330d..d65c0b3ab 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -38,54 +38,6 @@ }) <% course_activities.each do |activity| if course_activities %> <% if activity && activity.course_act%> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 0c4f4c1e0..c7e4a7428 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -32,9 +32,9 @@
    <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> +

    -
    取消 留言 <% end %> diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index 455ced056..f26c5fd41 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -1,18 +1,25 @@ -<% unless excellent_course_recommend(course).count == 0 %> - -<% end %> - +<% unless excellent_course_recommend(course).length == 0 %> + +<% end %> + diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index 2d08e853e..612f408d7 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -28,7 +28,7 @@
  • <% end %> -
  • 作业积分(总分)<%= @member_score.student_work_score_sum %>
  • +
  • 作业积分(总分)<%= (@member_score.student_work_score_sum).first.score %>
  • diff --git a/app/views/courses/_user_homework_search_list.html.erb b/app/views/courses/_user_homework_search_list.html.erb new file mode 100644 index 000000000..585d8761a --- /dev/null +++ b/app/views/courses/_user_homework_search_list.html.erb @@ -0,0 +1,46 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> +<% end %> + + +
    + <% homework_commons.each do |homework_common|%> + + <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> + <% end%> + <% if homework_commons.count == 10%> + <%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> + <% end%> +
    \ No newline at end of file diff --git a/app/views/courses/homework_search.js.erb b/app/views/courses/homework_search.js.erb new file mode 100644 index 000000000..3c644ad9e --- /dev/null +++ b/app/views/courses/homework_search.js.erb @@ -0,0 +1,5 @@ +<% if @page == 0 %> + $("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% else %> + $("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); +<% end %> \ No newline at end of file diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index 9d20b5adb..8182c949c 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -40,7 +40,8 @@ } } $(function() { - init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>"); + //init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>"); + sd_create_editor_from_data(<%= @article.id%>,null,"100%", "<%=@article.class.to_s%>"); showNormalImage('message_description_<%= @article.id %>'); }); @@ -94,7 +95,7 @@
    <%= format_time( @article.created_on)%>
    -
    +
    <%= @article.content.html_safe%>
    @@ -201,8 +202,8 @@ +
    -

    @@ -214,4 +215,16 @@
    <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 85b230be3..cf91b7814 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -126,4 +126,4 @@ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 88c30e1b7..e8f4f023b 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -95,4 +95,4 @@ <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index eed9266d5..1de0e8dc2 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -74,7 +74,7 @@ -<% html_title(l(:label_attachment_plural)) -%> +<%# html_title(l(:label_attachment_plural)) -%> <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 5708f6b3d..21519d5a1 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -2,7 +2,7 @@ $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') - sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>"); issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, @@ -18,9 +18,10 @@ "fileManagerJson":"/kindeditor/filemanager"}); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') - sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); + sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>"); <%else%> - $("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); + $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); + sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity"); +//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb index 34e874f13..ed4666d0c 100644 --- a/app/views/issues/add_journal_in_org.js.erb +++ b/app/views/issues/add_journal_in_org.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/issues/add_reply.js.erb b/app/views/issues/add_reply.js.erb index 0ee9d30e7..500451781 100644 --- a/app/views/issues/add_reply.js.erb +++ b/app/views/issues/add_reply.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/delete_journal.js.erb b/app/views/issues/delete_journal.js.erb index 63a1a5f96..7c7f25c1c 100644 --- a/app/views/issues/delete_journal.js.erb +++ b/app/views/issues/delete_journal.js.erb @@ -1,3 +1,3 @@ $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') -sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); \ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 4217ca44e..ad5d971ed 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -3,15 +3,15 @@ <% end %>
    - <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> + <% if @topic.status == 1 %> + <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %> + <% else %> + <%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %> + <% end %>
    <% if User.current.logged? %> @@ -60,7 +64,7 @@ ) if @message.course_destroyable_by?(User.current) %> <% end %> -
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • @@ -72,15 +76,19 @@
    - <% if @topic.try(:author).try(:realname) == ' ' %> - <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% if @topic.status == 1 %> + 确实团队 <% else %> - <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> <% end %>
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    @@ -168,4 +176,16 @@
    <% end %>
    -
    \ No newline at end of file +
    + diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 6d12fe960..4d5af61dd 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -58,7 +58,8 @@ } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + //init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); @@ -68,7 +69,7 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
    - <% if @message.org_subfield_editable_by?(User.current) %> + <% if User.current.logged? %>
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    @@ -197,4 +199,16 @@
    <% end %>
    - \ No newline at end of file + + diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index c98f2983e..3a306ba74 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -88,7 +88,7 @@ } } $(function() { - init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); + sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>"); showNormalImage('message_description_<%= @topic.id %>'); }); @@ -115,7 +115,7 @@ ) if @message.destroyable_by?(User.current) %> <% end %> -
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • @@ -135,7 +135,7 @@
    <%= format_time( @topic.created_on)%>
    -
    +
    <%= @topic.content.html_safe%>
    @@ -225,3 +225,15 @@
    + diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index a859a088a..15cb465de 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -18,8 +18,8 @@ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> +
    -

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

    "); diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index f61de74f0..385a49a82 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -5,4 +5,4 @@ <% elsif @org_subfield %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> -init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", "UserActivity"); \ No newline at end of file +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/news/_course_news_detail.html.erb b/app/views/news/_course_news_detail.html.erb index 954f7dbf1..61db84134 100644 --- a/app/views/news/_course_news_detail.html.erb +++ b/app/views/news/_course_news_detail.html.erb @@ -1,19 +1,19 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> <% if newss%> <% newss.each do |news| %> @@ -40,7 +40,7 @@ } $(function () { - init_activity_KindEditor_data(<%= news.id%>, null, "87%"); + sd_create_editor_from_data(<%= news.id%>, null, "100%"); showNormalImage('activity_description_<%= news.id %>'); }); diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 767c11553..3236aa6a0 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -85,7 +85,7 @@
    <%= format_time( @news.created_on)%>
    -
    +
    <%= @news.description.html_safe%>
    @@ -182,3 +182,15 @@ <% end %>
    + diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index 3e608c177..0a7770ac0 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -1,174 +1,186 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> -<% end %> - - - - -
    -
    -
    - <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> -
    -
    - <% if User.current.logged? %> - - <%end%> - -
    - -
    - <% if @news.try(:author).try(:realname) == ' ' %> - <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
    -
    <%= format_time( @news.created_on)%>
    -
    -
    - <%= @news.description.html_safe%> -
    -
    -
    - <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %> -
    -
    -
    -
    -
    -
    - <% unless @comments.empty? %> -
    -
    回复(<%=@comments.count %>)
    -
    -
    -
    - <% @comments.each_with_index do |reply,i| %> - -
    -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
    -
    -
    - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
    -
    - <%= reply.comments.html_safe%> -
    -
    - <%= format_time(reply.created_on) %> - -
    -

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

    -

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

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

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

    +

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

    + <% end %> +
    +
    +
    + <% end %> +
    +
    + diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index fa2a99cd7..1b4c51cd0 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -23,7 +23,7 @@
    - 项目通知 + 新闻
    <% if @project && User.current.allowed_to?(:manage_news, @project) %> diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb index fdb035bf5..518a29fa9 100644 --- a/app/views/news/_project_news_detail.html.erb +++ b/app/views/news/_project_news_detail.html.erb @@ -1,19 +1,19 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> + <%= javascript_include_tag "create_kindeditor" %> <% end %> <% if all_news %> <% all_news.each do |news| %> @@ -40,7 +40,7 @@ } $(function () { - init_activity_KindEditor_data(<%= news.id%>, null, "87%"); + sd_create_editor_from_data(<%= news.id%>, null, "100%"); showNormalImage('activity_description_<%= news.id %>'); }); diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb index 0e9b03c6f..e3d63ba9c 100644 --- a/app/views/news/_project_news_new.html.erb +++ b/app/views/news/_project_news_new.html.erb @@ -6,7 +6,7 @@
    - +

    <%end%>
    @@ -85,7 +85,7 @@
    <%= format_time( @news.created_on)%>
    -
    +
    <%= @news.description.html_safe%>
    @@ -182,3 +182,15 @@ <% end %>
    + diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index 76259f5d7..116000a8e 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -11,7 +11,7 @@
    - 编辑通知 + 编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
    <%= labelled_form_for :news, @news, :url => news_path(@news), diff --git a/app/views/org_document_comments/_attachment.html.erb b/app/views/org_document_comments/_attachment.html.erb index 86298a330..9acdc2dc8 100644 --- a/app/views/org_document_comments/_attachment.html.erb +++ b/app/views/org_document_comments/_attachment.html.erb @@ -7,7 +7,7 @@ <% if defined?(container) && container && container.saved_attachments %> <% container.attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>: + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>: <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> <%= if attachment.id.nil? #待补充代码 diff --git a/app/views/org_document_comments/_reply_form.html.erb b/app/views/org_document_comments/_reply_form.html.erb index 8808ff8b7..60db259c6 100644 --- a/app/views/org_document_comments/_reply_form.html.erb +++ b/app/views/org_document_comments/_reply_form.html.erb @@ -1,2 +1,2 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); diff --git a/app/views/org_document_comments/_simple_ke_reply_form.html.erb b/app/views/org_document_comments/_simple_ke_reply_form.html.erb index cfa197ff4..c0166f5ce 100644 --- a/app/views/org_document_comments/_simple_ke_reply_form.html.erb +++ b/app/views/org_document_comments/_simple_ke_reply_form.html.erb @@ -18,8 +18,8 @@ <%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %> +
    -

    diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 968d7295d..79858dd03 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,2 +1,2 @@ $("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>"); -init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>"); +sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>"); diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 1b807220d..a6681d047 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -1,9 +1,13 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= javascript_include_tag "des_kindEditor" %> <% end %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index dd747f8fa..c95cfe805 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -1,8 +1,12 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= javascript_include_tag "des_kindEditor" %> <% end %> -<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> -
    -
    +
    + <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> +
    -
    -
    +
    +
    +
    - <%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> + + <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>

    @@ -49,12 +55,11 @@
    - 确定 + 确定 - 取消 + 取消
    -
    + <% end %>
    -<% end %> \ No newline at end of file diff --git a/app/views/org_document_comments/quote.js.erb b/app/views/org_document_comments/quote.js.erb index 7ea5daf7b..53d22eb58 100644 --- a/app/views/org_document_comments/quote.js.erb +++ b/app/views/org_document_comments/quote.js.erb @@ -3,7 +3,7 @@ if($("#reply_message_<%= @org_comment.id%>").length > 0) { $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); - init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%", "<%=@org_comment.class.to_s%>"); + sd_create_editor_from_data(<%= @org_comment.id%>,null,"100%", "<%=@org_comment.class.to_s%>"); }); }else if($("#reply_to_message_<%= @org_comment.id %>").length >0) { $("#reply_to_message_<%= @org_comment.id%>").replaceWith("

    "); diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 405631369..be504a674 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -1,7 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %> @@ -150,9 +150,14 @@ <% if act.container_type == 'Organization' %> diff --git a/app/views/org_subfields/_show_post_type.html.erb b/app/views/org_subfields/_show_post_type.html.erb index bc95c0774..59d39067e 100644 --- a/app/views/org_subfields/_show_post_type.html.erb +++ b/app/views/org_subfields/_show_post_type.html.erb @@ -4,19 +4,6 @@ <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <% end %> - -
    <%= @org_subfield.name %>
    diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb index 82203b4de..7d3a2b969 100644 --- a/app/views/org_subfields/show.html.erb +++ b/app/views/org_subfields/show.html.erb @@ -178,20 +178,6 @@ } - - function org_id_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - $(".orgDirection").text(orgDirection + sendText); - } - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - - function course_attachmenttypes_change(id, type) { <% if @course%> $.ajax({ diff --git a/app/views/org_subfields/update_sub_dir.js.erb b/app/views/org_subfields/update_sub_dir.js.erb index 7960ca26c..3d42c260b 100644 --- a/app/views/org_subfields/update_sub_dir.js.erb +++ b/app/views/org_subfields/update_sub_dir.js.erb @@ -1,11 +1,6 @@ -<% if @exist == false %> +<% if @exist == false and @sub_dir.valid? %> $('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>'); $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>'); -// $('#sub_dir_show_<%= @org_subfield.id %>').show(); -// $('#sub_dir_edit_<%= @org_subfield.id %>').hide(); <% else %> $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>'); -// alert("该目录已存在,请重新输入"); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').find('input').val('<%#= @org_subfield.subfield_subdomain_dir.nil? ? "未设置":@org_subfield.subfield_subdomain_dir.name %>'); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').focus(); <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 6579ccbca..20b98ffa0 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -38,7 +38,7 @@ <% org_activities.each do |act| %> <% if act.container_type == 'Organization' %> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 3446a86d4..b5e3c6958 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -194,7 +194,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

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

    -

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

    +

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

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    @@ -326,8 +326,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %> +
    -

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

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

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

    diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 96ed6adff..55f03a367 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -12,8 +12,7 @@ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%> - + <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
    <% if activity.parent_id.nil? %> @@ -44,6 +43,33 @@
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    +
    +
      +
    • + <% if User.current.logged? %> +
        +
      • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %>
      • +
      • + <%= link_to( + l(:button_edit), + {:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id}, + :class => 'postOptionLink' + ) if activity.org_subfield_editable_by?(User.current) %> +
      • +
      • + <%= link_to( + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id}, + :method => 'post', + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.org_subfield_editable_by?(User.current) %> +
      • +
      + <% end %> +
    • +
    +
    @@ -119,8 +145,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
    -

    diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index fb18c0f7f..891ad14a7 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -35,7 +35,21 @@
  • <% if User.current.logged? %>
      -
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
    • +
    • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • + <%= link_to( + l(:button_edit), + {:controller => 'news', :action => 'edit', :id => activity}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
    • +
    • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
    <% end %>
  • @@ -114,8 +128,8 @@
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> +
    -

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

    diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index f6d5fc9ea..0e725532e 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -1,72 +1,77 @@ -
    -
    - -
    -
    <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
    - <% unless document.content.blank? %> -
    - <%= document.content.html_safe %> -
    - <% end %> - <% if params[:show_homepage].nil? %> -
    - 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %> -
    -
    -
    - 最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %> -
    - <% end %> - - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %> -
    -
      -
    • -
        -
      • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'cancel_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %> - 取消首页 - <% end %> -
      • -
      • - <%= link_to "编辑首页", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 2), :class => "postOptionLink" %> -
      • -
      • - <%= link_to "删除首页", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> -
      • -
      -
    • -
    -
    -
    - <% end %> -
    -
    - -
    - - \ No newline at end of file diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index d4b44a3d2..da458636a 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -20,10 +20,12 @@
    <% unless document.content.blank? %> -
    - <%= document.content.html_safe %> -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>document.id, :content=>document.content} %> <% end %> +
    + + +
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
    @@ -115,9 +117,8 @@
    <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> +
    - -
    @@ -133,9 +134,6 @@ \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 78fb12279..f217f006e 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -4,18 +4,6 @@ <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <% end %> - <% if params[:show_homepage].nil? and User.current.logged? %>
    <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
    @@ -61,7 +49,7 @@ <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index c03570072..75b07557e 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -58,4 +58,11 @@ <%end%> <% end%>
  • <%= format_date poll.created_at.to_date%>
  • + <% if poll.show_result == 1 %> + <% if has_commit%> +
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%>
  • + <%else%> +
  • 统计结果
  • + <%end%> + <% end %> <% end%> \ No newline at end of file diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index e6b667075..e08b13033 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -315,7 +315,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){ alert("问卷标题不能为空"); } else{ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>'); + if($("#show_result").is(":checked")) { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>'); + } else{ + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 0}) %>'); + } showModal('ajax-modal', '310px'); $('#ajax-modal').css('height','120px'); $('#ajax-modal').siblings().remove(); @@ -377,7 +381,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){ <%= l(:label_memo_create)%>
    - +
    diff --git a/app/views/poll/_poll_submit.html.erb b/app/views/poll/_poll_submit.html.erb index af3ca2d42..41e402dca 100644 --- a/app/views/poll/_poll_submit.html.erb +++ b/app/views/poll/_poll_submit.html.erb @@ -15,7 +15,7 @@ 是否确定发布该问卷?

    - <%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote), :class => "upload_btn", :onclick => "clickCanel();" %> + <%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote,:show_result => show_result), :class => "upload_btn", :onclick => "clickCanel();" %> 取  消 diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index deb0af842..062d64096 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -37,15 +37,15 @@ <% unless forge_acts.empty? %> <% forge_acts.each do |activity| -%> @@ -68,7 +68,7 @@ } $(function () { - init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>"); + sd_create_editor_from_data(<%= activity.id %>, null, "100%", "<%= activity.class.to_s %>"); }); diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 2614462d7..518ee3a2b 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -108,8 +108,8 @@
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> - -
    +
    +

    diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index d98a9fe0f..d6977325c 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -1,139 +1,140 @@ -
    -
    -
      -
    • - 上交时间: - <%=format_time work.created_at %> -
    • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
    • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> -
    • -
    • - <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> -
    • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> - -
    • - <%= render :partial => 'student_work_praise' %> -
    • - <% end%> -
      - -
    • - 编程代码: -
      -
      -
      -
      -
    • - -
    • - - 测试结果: - -
      - <% work.student_work_tests.each_with_index do |test, index| %> -
      -

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

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

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

      + + <%= test.created_at.to_s(:db) %> + +
      +
      + <% if test.status.to_i == -2 %> +
      + <%= test.results.first %> +
      + <% else %> +
      +
        + <% test.results.each_with_index do |x, i| %> +
      • + 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: +
        <%=x["result"]%>
        + 正确输出: +
        <%=x["output"]%>
        +
        + <% else %> + 测试正确! +
        + <% end %> +
      • + <% end %> +
      +
      + <% end %> + <% end %> +
      +
    • + +
    • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + +
      + <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> +
      + <% end%> +
      +
    • +
    + +
    + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
    +
    + +
    + <%student_work_scores.each do |student_score|%> +
    + <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
    + <% end%> +
    +
    + + 收起 +
    +
    + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 662ddece4..d66a30718 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,139 +1,140 @@ -
    -
    - <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> - <% if @homework.homework_type != 3 %> - <% is_my_work = work.user == User.current%> - <% else %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% is_my_work = pro && pro.student_work_id == work.id%> - <% end %> -
      -
    • - 上交时间: - <%=format_time work.created_at %> -
    • - - <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> - -
    • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> -
    • -
    • - <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> -
    • - <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> - -
    • - <%= render :partial => 'student_work_praise' %> -
    • - <% end%> -
      - - - - <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> -
      -
    • - 参与人员: - <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> - <% members = work.student_work_projects.where("is_leader = 0") %> - <% members.each do |member| if !members.empty? %> - 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> - <% end %> - <% end %> -
    • - <% if @homework.homework_detail_group.base_on_project == 1 %> -
    • - 关联项目: - <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - <% else %> - <%=work.project.name %> - <% end %> - <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> - (综合评分:<%=work.project.project_score.score.to_i %>) -
    • - <% end %> - <% end%> - -
    • - 内容: -
      - <%= text_format(work.description) if work.description%> -
      -
      -
    • -
    • - 附件: - <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> - <% if com_attachments.empty?%> - 尚未提交附件 - <% else%> -
      - <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> -
      - <% end%> -
      -
    • -
    • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> - -
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> -
      - <% end%> -
      -
    • -
    - -
    - <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> -
    -
    - -
    - <%student_work_scores.each do |student_score|%> -
    - <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> -
    - <% end%> -
    - - 收起 -
    -
    - \ No newline at end of file diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb index c4b2a795e..6a8591197 100644 --- a/app/views/student_work/_work_attachments_status.html.erb +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -1,7 +1,7 @@ <% attachments.each_with_index do |attachment,i| %>
    - + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> diff --git a/app/views/student_work/_work_edit_information.html.erb b/app/views/student_work/_work_edit_information.html.erb index 38670d9e4..1934d15eb 100644 --- a/app/views/student_work/_work_edit_information.html.erb +++ b/app/views/student_work/_work_edit_information.html.erb @@ -13,7 +13,15 @@ <%= "无附件"%> <% else %>
    - <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> + <% @student_work.attachments.each_with_index do |attachment,i| %> +
    + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %> + (<%= number_to_human_size attachment.filesize %>) +
    +
    + <% end -%> + <%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
    <% end %>

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

    diff --git a/app/views/student_work/cancel_relate_project.js.erb b/app/views/student_work/cancel_relate_project.js.erb index 3aa853a00..f5caf2e8f 100644 --- a/app/views/student_work/cancel_relate_project.js.erb +++ b/app/views/student_work/cancel_relate_project.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% else%> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/forbidden_anonymous_comment.js.erb b/app/views/student_work/forbidden_anonymous_comment.js.erb index 47dfb4b51..d869cba58 100644 --- a/app/views/student_work/forbidden_anonymous_comment.js.erb +++ b/app/views/student_work/forbidden_anonymous_comment.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); -init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); +sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); +sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% end %> \ No newline at end of file diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index 52a13f632..fa1308873 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,8 +1,8 @@ clickCanel(); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% end %> diff --git a/app/views/student_work/student_work_project.js.erb b/app/views/student_work/student_work_project.js.erb index 405dccca4..217a68422 100644 --- a/app/views/student_work/student_work_project.js.erb +++ b/app/views/student_work/student_work_project.js.erb @@ -1,8 +1,8 @@ hideModal("#popbox02"); <% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% else%> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% end %> \ No newline at end of file diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index de8c0a4d2..c8e91c1a2 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -3,7 +3,7 @@ <% if @tags.size > 0 %> <% @tags.each do |tag| %> <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> - <%= tag %> + <%= tag %> <% case object_flag %> <% when '10' %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 5be1334c3..d508fe1af 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -193,7 +193,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

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

    -

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

    +

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

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    @@ -326,8 +326,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %> +
    -

    diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index affc4cf36..6b28fb568 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -94,8 +94,8 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> +
    -

    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index dbc9c3041..7e8a24bb2 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,15 +1,23 @@
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> + <% if activity.status == 1 %> + <%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %> + <% else %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> + <% end %>
    - <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% if activity.status == 1 %> + 确实团队 <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <% end %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> @@ -79,9 +87,7 @@ ) if activity.course_destroyable_by?(User.current) %> <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • @@ -170,8 +176,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%> +
    -

    diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 67d09d365..15dd486ec 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -40,7 +40,21 @@
  • <% if User.current.logged? %>
      -
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • + <%= link_to( + l(:button_edit), + {controller:'news', :action => 'edit', :id => activity.id}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
    • +
    • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
    <% end %>
  • @@ -119,8 +133,8 @@
    <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> +
    -

    diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb new file mode 100644 index 000000000..d650cd084 --- /dev/null +++ b/app/views/users/_homework_detail_information.html.erb @@ -0,0 +1,31 @@ +
    题目信息
    +
    + <% if homework.nil? %> + 请先在左侧选择作业 + <% else %> +
    标题:<%=homework.name %>
    + 来源:<%=homework.course.name %>
    + <% if homework.homework_type == 2 && homework.homework_detail_programing %> + 编程语言:<%=homework.language_name %>
    + <% end %> + 贡献者:<%=homework.user.show_name %> + <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %> + ,<%=homework.user.user_extensions.occupation%> + <% end %> +
    + 描述如下: +
    +
    + <%=homework.description.html_safe %> +
    + <% if homework.homework_type == 2 %> +
    + 测试集:<%=homework.homework_tests.count %>组 +
    + <% elsif homework.homework_type ==3 && homework.homework_detail_group %> +
    + 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人 +
    + <% end %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb new file mode 100644 index 000000000..ba85f0d09 --- /dev/null +++ b/app/views/users/_homework_search_input.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/_homework_type_notice.html.erb b/app/views/users/_homework_type_notice.html.erb new file mode 100644 index 000000000..4dda65e49 --- /dev/null +++ b/app/views/users/_homework_type_notice.html.erb @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index 668a26cec..c18e520ba 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,13 +1,18 @@ -
    -
    - <%= content.to_s.html_safe%> -
    -
    - \ No newline at end of file diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb index 13bf6d79a..d36d9cee0 100644 --- a/app/views/users/_jour_form.html.erb +++ b/app/views/users/_jour_form.html.erb @@ -8,11 +8,12 @@ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= f.kindeditor :content, :editor_id => 'jour_content_editor', :width => '99.7%', - :height => 40, - :minHeight=>40, + :height => 100, + :minHeight=>100, :input_html => { :id => 'jour_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 } + %>

    diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 618dc3185..c5d93e0a5 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,9 +52,13 @@
    <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> -
    - <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> -
    + <% if User.current.member_of?(activity.project) %> + <% unless params[:action] == "index" %> +
    + <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> +
    + <% end %> + <% end %>
    diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index e46761bd1..1235b4e53 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -1,115 +1,115 @@ - -
    -
    -
      - <%#= labelled_fields_for :issue, @issue do |f| %> - <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), - {:include_blank => false, :selected => @status_id ? @status_id : 0 }, - {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> - <%# end %> - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> -
    • -

       状态  : 

      -

      <%= activity.status.name %>

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

       指派  : 

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

       优先级  : 

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

       完成度  : 

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

       开始  : 

      -

      <%= format_date(activity.start_date) %>

      -
    • -
      -
    • -

       周期  : 

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

       计划完成  : 

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

       目标版本  : 

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

       状态  : 

      +

      <%= activity.status.name %>

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

       指派  : 

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

       优先级  : 

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

       完成度  : 

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

       开始  : 

      +

      <%= format_date(activity.start_date) %>

      +
    • +
      +
    • +

       周期  : 

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

       计划完成  : 

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

       目标版本  : 

      + <%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>
    • +
      +
    +
    \ No newline at end of file diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb index 0a84ba9c4..adebd74ad 100644 --- a/app/views/users/_project_issue_reply.html.erb +++ b/app/views/users/_project_issue_reply.html.erb @@ -74,8 +74,8 @@
    <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %> +
    -

    diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d4a7a9e60..30183c4d1 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -71,9 +71,7 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
  • - <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %> -
  • +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
  • @@ -154,8 +152,8 @@ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> +
    -

    diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index eb4941668..9e02c4cf4 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -10,8 +10,8 @@ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> - <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目通知", project_news_index_path(activity.project), :class => "newsBlue ml15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
    - diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb new file mode 100644 index 000000000..eda4a9b97 --- /dev/null +++ b/app/views/users/_share_message_to_course.html.erb @@ -0,0 +1,56 @@ + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_course_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb new file mode 100644 index 000000000..da3c7a072 --- /dev/null +++ b/app/views/users/_share_message_to_org.html.erb @@ -0,0 +1,59 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb new file mode 100644 index 000000000..4b79a779c --- /dev/null +++ b/app/views/users/_share_message_to_project.html.erb @@ -0,0 +1,53 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
    + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index dc6599884..9de431336 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -6,11 +6,16 @@
    - + <% if (user.user_extensions && (user.user_extensions.identity != 2) ) %> + + <% end %> +

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

    diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index ef0265683..004c8fec4 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -1,13 +1,35 @@ -<% user_homeworks.each do |homework|%> -
      -
    • - -
    • - -
    -
    - 创建时间:<%= format_date homework.created_at%> -
    -<% end%> \ No newline at end of file +<% homeworks.each do |homework| %> +
      + +
    • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
    • +
    • <%= homework.quotes %>
    • + +
    • <%=format_date homework.publish_time %>
    • +
    +<% end %> + \ No newline at end of file diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index 935cc4513..d2b3f286d 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -1,27 +1,52 @@ -
    -
    -
    导入作业
    -
    - -
    - <%= form_tag user_search_homeworks_user_path(User.current.id), :multipart => true, :remote => true, :class => "coursesSearchBox" do%> - - - <% end%> -
    - <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> - -
    - <%= render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks}%> -
    -
    -
    - 确定 +
    +
    选用题库中的题目
    +
    + 公共题库 + 我的题库 +
    + <%=render :partial=>'homework_search_input', :locals=>{:type=>@type} %> +
    +
    +
    +
      + +
    • 类型
    • +
    • 引用数
    • +
    • 贡献者
    • +
    • 发布时间
    • +
    +
    + <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> + +
    + <%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
    -
    - 取消 -
    -
    - <% end%> + <% end %> +
    + 选用 +
    +
    + 取消 +
    +
    +
      + <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%> +
    +
    +
    +
    +
    + <%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %> +
    -
    \ No newline at end of file +
    + diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 62752bdf5..59d605a09 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -16,6 +16,7 @@ $(this).children(".userCard").css("display","none"); }) $(".userCard").mouseover(function(){ + $(this).css("display","block"); }) $(".userCard").mouseout(function(){ @@ -39,15 +40,15 @@ <% user_activities.each do |user_activity| if user_activities %> @@ -74,7 +75,7 @@ } $(function() { - init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%", "<%=user_activity.class.to_s%>"); + sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>"); }); <% unless user_activity.act_type == "ProjectCreateInfo" %> @@ -111,7 +112,7 @@ <% case user_activity.act_type.to_s %> <% when 'JournalsForMessage' %> <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %> <% end %> <% end %> <% end %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 581bfb53c..244951dfa 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -15,7 +15,7 @@
    - <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id), :class => "postGrey" %> + <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
    <% if activity.sticky == 1%> 置顶 @@ -120,8 +120,8 @@ +
    -

    diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index a815d85e7..48c303a29 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -16,7 +16,7 @@

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

    取消 diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 5f4cb4a8e..673cee0e1 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -72,11 +72,15 @@ 上传附件 <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - +
    + 编程 + +
    <% end %> <% if defined?(has_group) && has_group %> - 分组 +
    + 分组 +
    <% end %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 04c8b8f0a..01673d164 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -195,7 +195,7 @@ <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>

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

    -

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

    +

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

    项目名称:<%=project.name %>
    创建者:<%=(User.find project.user_id).show_name %>(组长)
    @@ -328,8 +328,8 @@ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %> <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %> +
    -

    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 5c9386f94..0d542882a 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -9,11 +9,14 @@ } else { $("#anonymous_comment").attr('checked',false); } - $("#BluePopupBox a.BlueCirBtn").click(); + <% if edit_mode && homework.is_program_homework? %> + $("#BluePopupBox a.BlueCirBtn").click(); + <% end %> <% if edit_mode && homework.is_group_homework? %> - $("#GroupPopupBox a.group_btn").click(); + $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); + var homework_description_editor; function checked_val() { if ($("#anonymous_comment").is(":checked")) { $("#anonymous_comment").val(1); @@ -21,6 +24,120 @@ $("#anonymous_comment").val(0); } } + function nh_reset_homework_form(params){ + if(params.textarea.html() != "") { + cancel_edit(); + } else { + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + } + } + function init_homework_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = false; + checked_val(); + if(!regex_homework_name()){ + $("#homework_name").focus(); + } + else if(!regex_homework_end_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_homework_end_publish_time()){ + $("#homework_end_time").focus(); + } + else if(!regex_course_id()){ + $("#course_id").focus(); + } + else{ + params.textarea.html(params.editor.html()); + params.editor.sync(); + is_checked = true; + } + /*var is_checked = nh_check_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + });*/ + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); + } + function init_homework_editor(params){ + params.textarea.removeAttr('placeholder'); + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + var edit = this.edit; + var body = edit.doc.body; + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + var body = edit.doc.body; + edit.html(params.textarea.innerHTML); + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); + + } + }).loadPlugin('paste'); + return editor; + } + KindEditor.ready(function(K){ + $("div[nhname='homework_common_form']").each(function(){ + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form",params.div_form); + if(params.form==undefined || params.form.length==0){ + return; + } + params.textarea = $("textarea[nhname='homework_textarea']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); + params.submit_btn = $("#new_message_submit_btn"); + if(params.textarea.data('init') == undefined) { + params.editor = init_homework_editor(params); + homework_description_editor = params.editor; + init_homework_form(params); + params.submit_btn.click(function () { + params.form.submit(); + }); + params.cancel_btn.click(function () { + reset_homework(); + nh_reset_homework_form(params); + }); + params.textarea.data('init', 1); + } + }); + }); <% end %> @@ -33,7 +150,10 @@
    - <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业(将于2016年春上线)") unless edit_mode%> + <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> + <% unless edit_mode %> + + <% end %> <% if edit_mode %> <% end %> @@ -65,10 +185,12 @@
    <% if edit_mode %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %> <% else %> <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> - <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> + + <%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %> <% end %>
    @@ -84,17 +206,16 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
    -
    <% if edit_mode %> - 确定 + 确定 <%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%> - 取消 + 取消 <% else %> - 发送 + 发送 - 取消 + 取消 <% end %>
    @@ -138,4 +259,10 @@ \ No newline at end of file +
    + +<% unless edit_mode %> + +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 36f823a9a..34e975762 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -2,22 +2,11 @@ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> - +
    <% homework_commons.each do |homework_common|%> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>0} %> <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> <% end %> <%end%> diff --git a/app/views/users/_user_message_org.html.erb b/app/views/users/_user_message_org.html.erb index 5bf1c8950..e3b656a46 100644 --- a/app/views/users/_user_message_org.html.erb +++ b/app/views/users/_user_message_org.html.erb @@ -12,7 +12,7 @@ <%= ma.content %>
  • - <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"已同意申请", + <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ), :id => "agree_apply_subdomain_#{ma.id}", :method => 'post', diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index 3f2e53fe8..71816689b 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -7,7 +7,7 @@ <%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
  • -
    +
    <% if edit_mode && homework.is_program_homework? %> <% homework.homework_tests.each_with_index do |test, index| %>
    diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index 0e2648509..eed789a29 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -22,9 +22,9 @@ 测试错误! 您的输出: - +
    正确输出: - +
    @@ -121,9 +121,9 @@ <% if x["status"].to_i != 0 %> 测试错误! 您的输出: - <%=x["result"]%> +
    <%=x["result"]%>
    正确输出: - <%=x["output"]%> +
    <%= x["output"] %>
    <% else %> diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 138eab6f9..11db47950 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -1,24 +1,26 @@ -//var screenWidth = $(window).width(); -//var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 -//var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 -//var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 -//var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 -//var popupHeight = $(".resourceSharePopup").outerHeight(true); -//$(".resourceSharePopup").css("marginTop",-popupHeight/2); -// -//$("#upload_box").css('left','').css('top',''); -//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -//$("#upload_box").css('display','block'); -<% if params[:send_type].present? && params[:send_type] == 'news' %> - $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> - $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); -$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -var val = $("#search_course_input").val(); -$("#search_course_input").val("").focus().val(val); +//var screenWidth = $(window).width(); +//var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 +//var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 +//var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 +//var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 +//var popupHeight = $(".resourceSharePopup").outerHeight(true); +//$(".resourceSharePopup").css("marginTop",-popupHeight/2); +// +//$("#upload_box").css('left','').css('top',''); +//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +//$("#upload_box").css('display','block'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'file' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% end %> +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); +$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +var val = $("#search_course_input").val(); +$("#search_course_input").val("").focus().val(val); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index fb6efec9a..0d4b71a60 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,12 +1,14 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); var val = $("#search_org_input").val(); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 926b7aa58..79615d301 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,12 +1,14 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% else %> +<% elsif params[:send_type] == 'file' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); //$("#search_project_input").focus(); diff --git a/app/views/users/share_message_to_course.js.erb b/app/views/users/share_message_to_course.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_course.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_org.js.erb b/app/views/users/share_message_to_org.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_org.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_message_to_project.js.erb b/app/views/users/share_message_to_project.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_message_to_project.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/show_homework_detail.js.erb b/app/views/users/show_homework_detail.js.erb new file mode 100644 index 000000000..12be1b786 --- /dev/null +++ b/app/views/users/show_homework_detail.js.erb @@ -0,0 +1 @@ +$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>") \ No newline at end of file diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb index 6f14ce05d..0f3c4810f 100644 --- a/app/views/users/user_commit_homework.html.erb +++ b/app/views/users/user_commit_homework.html.erb @@ -17,9 +17,9 @@ 测试错误! 您的输出: - +
    正确输出: - +
    @@ -95,9 +95,9 @@ <% if x["status"].to_i != 0 %> 测试错误! 您的输出: - <%=x["result"]%> +
    <%=x["result"]%>
    正确输出: - <%=x["output"]%> +
    <%=x["output"]%>
    <% else %> diff --git a/app/views/users/user_homework_type.js.erb b/app/views/users/user_homework_type.js.erb new file mode 100644 index 000000000..691fdc72b --- /dev/null +++ b/app/views/users/user_homework_type.js.erb @@ -0,0 +1,4 @@ +$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>'); +$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>"); +$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type}) %>"); \ No newline at end of file diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index 7be803720..d0adb291f 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -5,7 +5,11 @@ $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>"); - homework_description_editor.html(""); + //homework_description_editor.html(""); + $("#homework_name_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_end_time_span").text(""); + $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } @@ -29,7 +33,7 @@ <% if @is_teacher%> -
    +
    <% homework = HomeworkCommon.new %> <% homework.homework_detail_manual = HomeworkDetailManual.new%> <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %> diff --git a/app/views/users/user_import_homeworks.js.erb b/app/views/users/user_import_homeworks.js.erb index 5ce138b6a..47e04f906 100644 --- a/app/views/users/user_import_homeworks.js.erb +++ b/app/views/users/user_import_homeworks.js.erb @@ -1,7 +1,7 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>'); -showModal('ajax-modal', '580px'); -$('#ajax-modal').css('height','300px').css("width","580px"); +showModal('ajax-modal', '1040px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9"); +var mTop = ($(window).height()-646)/2; +var mLeft = ($(window).width()-1054)/2; +$('#ajax-modal').parent().css("border","3px solid #269ac9").css("top","mTop").css("left","mLeft").css("position","fixed"); +$('#ajax-modal').css("margin","15px"); \ No newline at end of file diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index e395604f4..5abadfb29 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -21,7 +21,7 @@ showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","46%"); + $('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); } @@ -358,12 +358,14 @@ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 $.ajax({ type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() + url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize(), + data:{send_type:'file'} }); }else{ $.ajax({ type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() + url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize(), + data:{send_type:'file'} }); } diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb index 760d4fdf1..c8e3aab3e 100644 --- a/app/views/users/user_search_homeworks.js.erb +++ b/app/views/users/user_search_homeworks.js.erb @@ -1 +1,3 @@ -$("#homework_list_form_show").html("<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks})%>"); \ No newline at end of file +$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>'); +$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>"); \ No newline at end of file diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 9b4b43b33..21fd9db26 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,13 +5,16 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); <% if @select_course == "0"%> $("#course_id").val("<%= @homework.course_id%>"); <% end%> +$("#ref_homework_id").val("<%= @ref_homework.id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); -<% if @homework_detail_group %> - $('span.group_detail_info').text('分组人数:<%=@homework_detail_group.min_num %>-<%=@homework_detail_group.max_num %> 人'); -<% end %> -$("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); -$("#GroupPopupBox").html("<%=escape_javascript( render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); //$("input[name='homework_type']").val("<%#= @homework.homework_type%>"); +<% if @homework_detail_programing %> + $("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); + $("#BluePopupBox a.BlueCirBtn").click(); +<% elsif @homework_detail_group %> + $('span.group_detail_info').text('分组人数:<%=@homework_detail_group.min_num %>-<%=@homework_detail_group.max_num %> 人'); + $("#GroupPopupBox").html("<%=escape_javascript( render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); + $("#GroupPopupBox a.group_save_btn").click(); +<% end %> $("#homework_editor").show(); -$("#BluePopupBox a.BlueCirBtn").click(); diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index ac56b69fc..a5c572049 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,11 +1,12 @@ <% if @save_succ %> <% if @user_activity_id %> <% if @reply_type == 'user' %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); <% end %> - init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + #init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity"); <% else %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> $("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>"); diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 6a56249a3..819936f9f 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -2,13 +2,19 @@ alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> <% if @is_user%> - var destroyedItem = $('#<%=@journal_destroyed.id%>'); + <% if @activity %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>"); + init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").hide(); + <% end %> + /*var destroyedItem = $('#<%#=@journal_destroyed.id%>'); destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); - <% if @jours_count && @jours_count == 0 %> + <%# if @jours_count && @jours_count == 0 %> $("#user_jour_list").css("padding","0px"); - <% end %> + <%# end %>*/ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); @@ -19,10 +25,10 @@ <% elsif @homework%> <% if @user_activity_id == -1 %> $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); - init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + sd_create_editor_from_data(<%= @homework.id%>,"","100%"); <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); <% end %> <% end %> var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') diff --git a/app/views/words/leave_homework_message.js.erb b/app/views/words/leave_homework_message.js.erb index 5eeb9ce64..acb16be50 100644 --- a/app/views/words/leave_homework_message.js.erb +++ b/app/views/words/leave_homework_message.js.erb @@ -1,7 +1,7 @@ <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); + sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% elsif @homework_common_id && @is_in_course %> $("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); - init_activity_KindEditor_data(<%= @homework_common_id%>,"","87%", "HomeworkCommon"); + sd_create_editor_from_data(<%= @homework_common_id%>,"","100%", "HomeworkCommon"); <% end %> diff --git a/config/initializers/elasticsearch_dev_patch.rb b/config/initializers/elasticsearch_dev_patch.rb new file mode 100644 index 000000000..ac9b800ba --- /dev/null +++ b/config/initializers/elasticsearch_dev_patch.rb @@ -0,0 +1,53 @@ +#coding=utf-8 + +# elasticsearch 在开发环境下也要打开,很烦人的 + +if Rails.env.development? + + require 'elasticsearch/model' + module Elasticsearch + module Model + class NoObject + + instance_methods.each do |m| + undef_method(m) unless [:object_id, :__send__, :undef_method, :method_missing].include?(m) + end + + def method_missing(method, *args, &block) + puts "NoObject #{method} #{args}" + end + + def NoObject.included(mod) + puts "#{self} included in #{mod}" + end + + def self.extended(mod) + puts "#{self} extended in #{mod}" + end + + def initialize + puts methods + end + end + + def self.included(base) + base.instance_eval do + def settings(a) + end + + def __elasticsearch__ + @__elasticsearch__ ||= NoObject.new + end + end + + base.class_eval do + def __elasticsearch__ + @__elasticsearch__ ||= NoObject.new + end + end + end + + end + end + +end diff --git a/config/initializers/subdomain.rb b/config/initializers/subdomain.rb index b868e7e0b..f813a24a0 100644 --- a/config/initializers/subdomain.rb +++ b/config/initializers/subdomain.rb @@ -1,9 +1,30 @@ class Subdomain + def initialize(opt={}) + @opt = {}.merge(opt) + end + def matches?(request) - o = Organization.where(domain: request.subdomain).first - request.path_parameters[:id] = o.id if o - !o.nil? + puts request.path_parameters + o = ::Secdomain.where(subname: request.subdomain).first + + if(@opt[:sub]) + if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news' + request.path_parameters[:id] = o.pid + request.path_parameters[:controller] = 'org_subfields' + request.path_parameters[:action] = 'show' + return true + end + end + + + if o && o.controller + request.path_parameters[:id] = o.pid + request.path_parameters[:controller] = o.controller + request.path_parameters[:action] = o.action + return true + end + false end end \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index daa0c3a31..e9d3ed813 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -674,7 +674,7 @@ zh: label_day_plural: 天 label_repository: 版本库 label_course_repository: 代码库 - label_browse: 浏览 + label_browse: 上传文件 label_branch: 分支 label_tag: 标签 label_revision: 修订 diff --git a/config/routes.rb b/config/routes.rb index 148b6dea2..7060e4eb6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,15 @@ RedmineApp::Application.routes.draw do # Enable Grack support # mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] + constraints(Subdomain.new) do + get '/', to: 'organizations#show' + end + + constraints(Subdomain.new(sub: true)) do + get '/:sub_dir_name', to: 'fake#fake' + end + + resources :shield_activities do collection do delete 'show_acts' @@ -46,6 +55,7 @@ RedmineApp::Application.routes.draw do end end member do + get 'edit' get 'setting'#, :action => 'settings', :as => 'settings' get 'clear_org_avatar_temp' put 'set_homepage' @@ -75,12 +85,7 @@ RedmineApp::Application.routes.draw do end - constraints(Subdomain.new) do - get '/', to: 'organizations#show' - end - get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} - get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} - get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'} + resources :org_member do member do @@ -499,7 +504,7 @@ RedmineApp::Application.routes.draw do match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get get 'user_import_homeworks' - post 'user_search_homeworks' + get 'user_search_homeworks' get 'user_import_resource' match 'watch_projects', :to => 'users#watch_projects', :via => :get # @@ -538,6 +543,9 @@ RedmineApp::Application.routes.draw do post 'share_news_to_course' post 'share_news_to_project' post 'share_news_to_org' + post 'share_message_to_course' + post 'share_message_to_project' + post 'share_message_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' @@ -549,7 +557,9 @@ RedmineApp::Application.routes.draw do get 'user_organizations' get 'search_user_orgs' get 'search_user_org' #for send resource - + get 'user_homework_type' + get 'user_ref_homework_search' + get 'show_homework_detail' # end end #resources :blogs @@ -859,6 +869,7 @@ RedmineApp::Application.routes.draw do get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' + get 'attachments/download_history/:id/:filename', :to => 'attachments#download_history', :id => /\d+/, :filename => /.*/, :as => 'download_history_attachment' get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/ get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' get 'attachments/autocomplete' @@ -986,6 +997,7 @@ RedmineApp::Application.routes.draw do post 'set_course_outline' get 'syllabus' get 'search_public_orgs_not_in_course' + get "homework_search" end collection do match 'join_private_courses', :via => [:get, :post] @@ -1121,6 +1133,7 @@ RedmineApp::Application.routes.draw do match "/system_log" ,:to => 'system_log#index' match 'system_log/clear' get 'upload_files_menu', :to => 'files#upload_files_menu' + get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168") ##ended by lizanle resources :git_callback do diff --git a/db/migrate/20160122094805_excellent_course.rb b/db/migrate/20160122094805_excellent_course.rb new file mode 100644 index 000000000..465b81464 --- /dev/null +++ b/db/migrate/20160122094805_excellent_course.rb @@ -0,0 +1,17 @@ +class ExcellentCourse < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122094829_excellent_option_course.rb b/db/migrate/20160122094829_excellent_option_course.rb new file mode 100644 index 000000000..30ee53ba3 --- /dev/null +++ b/db/migrate/20160122094829_excellent_option_course.rb @@ -0,0 +1,19 @@ +class ExcellentOptionCourse < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122142844_excellent_course_se.rb b/db/migrate/20160122142844_excellent_course_se.rb new file mode 100644 index 000000000..c6f5dbb88 --- /dev/null +++ b/db/migrate/20160122142844_excellent_course_se.rb @@ -0,0 +1,17 @@ +class ExcellentCourseSe < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122143138_excellent_option_se.rb b/db/migrate/20160122143138_excellent_option_se.rb new file mode 100644 index 000000000..cee739b7f --- /dev/null +++ b/db/migrate/20160122143138_excellent_option_se.rb @@ -0,0 +1,19 @@ +class ExcellentOptionSe < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160126024429_update_journal_for_message.rb b/db/migrate/20160126024429_update_journal_for_message.rb new file mode 100644 index 000000000..f6b848c79 --- /dev/null +++ b/db/migrate/20160126024429_update_journal_for_message.rb @@ -0,0 +1,20 @@ +class UpdateJournalForMessage < ActiveRecord::Migration + def up + journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ") + count = journals.count / 30 + 2 + transaction do + for i in 1 ... count do i + journals.page(i).per(30).each do |jour| + act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first + unless act.nil? + jour.updated_on = act.updated_at + jour.save + end + end + end + end + end + + def down + end +end diff --git a/db/migrate/20160126031857_add_is_copy_to_course.rb b/db/migrate/20160126031857_add_is_copy_to_course.rb new file mode 100644 index 000000000..f60914bbd --- /dev/null +++ b/db/migrate/20160126031857_add_is_copy_to_course.rb @@ -0,0 +1,5 @@ +class AddIsCopyToCourse < ActiveRecord::Migration + def change + add_column :courses, :is_copy, :integer, :default => 0 + end +end diff --git a/db/migrate/20160128024452_add_quotes_to_homework.rb b/db/migrate/20160128024452_add_quotes_to_homework.rb new file mode 100644 index 000000000..7f02062fb --- /dev/null +++ b/db/migrate/20160128024452_add_quotes_to_homework.rb @@ -0,0 +1,5 @@ +class AddQuotesToHomework < ActiveRecord::Migration + def change + add_column :homework_commons, :quotes, :integer, :default => 0 + end +end diff --git a/db/migrate/20160202034530_create_secdomains.rb b/db/migrate/20160202034530_create_secdomains.rb new file mode 100644 index 000000000..49650d073 --- /dev/null +++ b/db/migrate/20160202034530_create_secdomains.rb @@ -0,0 +1,28 @@ +class CreateSecdomains < ActiveRecord::Migration + def change + create_table :secdomains do |t| + t.integer :sub_type #1.系统预留 2.Organization 3.users + t.string :subname #子域名 + t.integer :pid, default: 0 #参数id + t.string :desc + + t.timestamps + end + + #系统保留 + Secdomain.create(sub_type: 1, subname: 'gitlab') + Secdomain.create(sub_type: 1, subname: 'wechat') + Secdomain.create(sub_type: 1, subname: 'judge') + + #organization + Secdomain.create(sub_type: 2, subname: 'micros', pid: 5) + Secdomain.create(sub_type: 2, subname: 'nubot', pid: 23) + Secdomain.create(sub_type: 2, subname: 'team', pid: 1) + + #users + Secdomain.create(sub_type: 3, subname: 'whm', pid: 7) + Secdomain.create(sub_type: 3, subname: 'yg', pid: 5) + Secdomain.create(sub_type: 3, subname: 'wt', pid: 11) + + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e6291806..003d99c0f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,2027 +1,2040 @@ -# 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 => 20160122083507) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "at_messages", :force => true do |t| - t.integer "user_id" - t.integer "at_message_id" - t.string "at_message_type" - t.boolean "viewed", :default => false - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sender_id" - end - - add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" - - create_table "attachment_histories", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.string "filename", :default => "" - t.string "disk_filename", :default => "" - t.integer "filesize", :default => 0 - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "" - t.integer "downloads", :default => 0 - t.integer "author_id" - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.integer "copy_from" - t.integer "quotes" - t.integer "version" - t.integer "attachment_id" - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "homepage_id" - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - t.integer "org_subfield_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - create_table "course_activities", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_act_id" - t.string "course_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score" - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_messages", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_message_id" - t.string "course_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 - t.integer "end_time" - t.string "end_term" - t.integer "is_excellent", :default => 0 - t.integer "excellent_option", :default => 0 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "documents", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "category_id", :default => 0, :null => false - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 - t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false - end - - create_table "editor_of_documents", :force => true do |t| - t.integer "editor_id" - t.integer "org_document_comment_id" - t.datetime "created_at" - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" - - create_table "forge_messages", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_message_id" - t.string "forge_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - end - - add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - t.integer "private", :default => 0 - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.integer "quotes" - t.integer "status", :default => 0 - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_messages", :force => true do |t| - t.integer "user_id" - t.integer "sender_id" - t.integer "organization_id" - t.string "message_type" - t.integer "message_id" - t.integer "viewed" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 0 - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "org_subfield_messages", :force => true do |t| - t.integer "org_subfield_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_subfields", :force => true do |t| - t.integer "organization_id" - t.integer "priority" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "field_type" - t.integer "hide", :default => 0 - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "allow_guest_download", :default => true - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - t.integer "board_num", :default => 0 - t.integer "attach_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - t.integer "forked_from_project_id" - t.integer "forked_count" - t.integer "commits_count", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "issues_count", :default => 0 - t.integer "attachments_count", :default => 0 - t.integer "boards_count", :default => 0 - t.integer "news_count", :default => 0 - t.integer "acts_count", :default => 0 - t.integer "journals_count", :default => 0 - t.integer "boards_reply_count", :default => 0 - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "shield_activities", :force => true do |t| - t.string "container_type" - t.integer "container_id" - t.string "shield_type" - t.integer "shield_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_projects", :force => true do |t| - t.integer "homework_common_id" - t.integer "student_work_id" - t.integer "project_id" - t.integer "user_id" - t.integer "is_leader" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" - add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" - add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" - add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "subfield_subdomain_dirs", :force => true do |t| - t.integer "org_subfield_id" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - t.integer "gid" - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end +# 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 => 20160202034530) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "at_messages", :force => true do |t| + t.integer "user_id" + t.integer "at_message_id" + t.string "at_message_type" + t.boolean "viewed", :default => false + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sender_id" + end + + add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "attachment_id" + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "homepage_id" + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + t.integer "org_subfield_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_attachments", :force => true do |t| + t.string "filename" + t.string "disk_filename" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_contributor_scores", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.integer "message_num" + t.integer "message_reply_num" + t.integer "news_reply_num" + t.integer "resource_num" + t.integer "journal_num" + t.integer "journal_reply_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "total_score" + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "content" + t.integer "status" + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 + t.integer "end_time" + t.string "end_term" + t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "documents", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "category_id", :default => 0, :null => false + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 + t.string "File" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false + end + + create_table "editor_of_documents", :force => true do |t| + t.integer "editor_id" + t.integer "org_document_comment_id" + t.datetime "created_at" + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + t.integer "quotes", :default => 0 + end + + add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + + create_table "journal_replies", :id => false, :force => true do |t| + t.integer "journal_id" + t.integer "user_id" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + t.integer "private", :default => 0 + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.integer "quotes" + t.integer "status", :default => 0 + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_messages", :force => true do |t| + t.integer "user_id" + t.integer "sender_id" + t.integer "organization_id" + t.string "message_type" + t.integer "message_id" + t.integer "viewed" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 0 + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "org_subfield_messages", :force => true do |t| + t.integer "org_subfield_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_subfields", :force => true do |t| + t.integer "organization_id" + t.integer "priority" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "field_type" + t.integer "hide", :default => 0 + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "allow_guest_download", :default => true + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + t.integer "board_num", :default => 0 + t.integer "act_num", :default => 0 + t.integer "attach_num", :default => 0 + t.datetime "commit_time" + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + t.integer "forked_from_project_id" + t.integer "forked_count" + t.integer "commits_count", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "issues_count", :default => 0 + t.integer "attachments_count", :default => 0 + t.integer "boards_count", :default => 0 + t.integer "news_count", :default => 0 + t.integer "acts_count", :default => 0 + t.integer "journals_count", :default => 0 + t.integer "boards_reply_count", :default => 0 + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "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 "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "student_work_projects", :force => true do |t| + t.integer "homework_common_id" + t.integer "student_work_id" + t.integer "project_id" + t.integer "user_id" + t.integer "is_leader" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" + add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" + add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" + add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + end + + add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "subfield_subdomain_dirs", :force => true do |t| + t.integer "org_subfield_id" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + t.string "identity_url" + t.string "mail_notification", :default => "", :null => false + t.string "salt", :limit => 64 + t.integer "gid" + end + + add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index a2d2214b6..f9ce21987 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -1,3 +1,4 @@ +#coding=utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -180,8 +181,20 @@ module Redmine end def render_single_menu_node(item, caption, url, selected) - - link_to(h(caption), url, item.html_options(:selected => selected)) + title = h(caption) + case title + when '作业' + title = h(caption) + "(#{HomeworkCommon.all.count})" + when '组织列表' + title = h(caption) + "(#{Organization.all.count})" + when '项目列表' + title = h(caption) + "(#{Project.all.count})" + when '课程列表' + title = h(caption) + "(#{Course.all.count})" + when '用户列表' + title = h(caption) + "(#{User.all.count})" + end + link_to(title, url, item.html_options(:selected => selected)) end diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake index 91c2ddff9..b9933cf75 100644 --- a/lib/tasks/elasticsearch_batch_op.rake +++ b/lib/tasks/elasticsearch_batch_op.rake @@ -1,38 +1,42 @@ namespace :importer do - task :importuser do + + task :importuser => :environment do ENV['CLASS']='User' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end - task :importproject do + task :importproject => :environment do ENV['CLASS']='Project' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end - task :importcourse do + task :importcourse => :environment do ENV['CLASS']='Course' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end - task :importattachment do + task :importattachment => :environment do ENV['CLASS']='Attachment' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end - task :importmemo do + task :importmemo => :environment do ENV['CLASS']='Memo' ENV['SCOPE']='indexable' ENV['FORCE']='y' ENV['BATCH']='1000' - Rake::Task["elasticsearch:import:model"].invoke + Rake::Task["elasticsearch:import:model"].execute end + + desc "Run all tasks" + task :all => [:importuser,:importproject,:importcourse,:importattachment,:importmemo] end \ No newline at end of file diff --git a/lib/tasks/import_fix.rake b/lib/tasks/import_fix.rake new file mode 100644 index 000000000..e5bd1a796 --- /dev/null +++ b/lib/tasks/import_fix.rake @@ -0,0 +1,14 @@ +namespace :import do + desc "fix import name" + task :fix => :environment do + HomeworkCommon.find_each do |homework| + name = homework.name.sub("\n", " ").sub("\r\n", " ") + if name != homework.name + homework.name = name + homework.save! + end + + end + end + +end diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index 74ee242f5..8ea6d9ed0 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -14,10 +14,10 @@ namespace :issue_due_date do recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) - # issue截止时间邮件提醒 - Mailer.issue_due_date(issue, recipients).deliver end end + # issue截止时间邮件提醒 + Mailer.issue_due_date(issue).deliver end end end diff --git a/public/images/hwork_icon.png b/public/images/hwork_icon.png index 8ae87460f..f531c3d4c 100644 Binary files a/public/images/hwork_icon.png and b/public/images/hwork_icon.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index f982d92f6..7f60b11b4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1032,6 +1032,7 @@ function subfield_click(){ $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); } +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { $('#'+fieldId).each(function() { var $this = $(this); @@ -1107,6 +1108,7 @@ function show_send(id, user_id, send_type){ //id 发送的id //发送的id数组 +//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 function chooseSendType(res_id,res_ids, user_id, send_type){ sendType = $(".resourcesSendType").val(); @@ -1135,3 +1137,17 @@ function chooseSendType(res_id,res_ids, user_id, send_type){ } lastSendType = sendType; } + +//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 +function disable_down(source, des, hint){ + if (source.attr("checked")){ + des.attr("disabled", false); + hint.html(""); + } + else{ + des.attr("checked", false); + des.attr("disabled", true); + hint.html("(私有组织不允许游客下载资源)"); + + } +} diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index b60b6ad28..5ddadb373 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -91,7 +91,7 @@ function addFile_board(inputEl, file, eagerUpload, id,btnId) { function addFile(inputEl, file, eagerUpload,btnId) { var attachments_frame = '#attachments_fields'; - if ($(attachments_frame).children().length < 30) { + if (true) { deleteallfiles = $(inputEl).data('deleteAllFiles'); var attachmentId = addFile.nextAttachmentId++; diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index 0eac4b01e..bc28aa2bd 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -10,16 +10,16 @@ function sd_create_editor(params){ resizeType : 1,minWidth:"1px",width:"94%", height:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", + width:params.width, items:['emoticons','fontname', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'formatblock', 'fontsize', '|','indent', 'outdent', - '|','imagedirectupload'], + '|','imagedirectupload','more'], afterChange:function(){//按键事件 - var edit = this.edit; var body = edit.doc.body; edit.iframe.height(paramsHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); + //this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); }, afterBlur:function(){ //params.toolbar_container.hide(); diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js new file mode 100644 index 000000000..1b952672a --- /dev/null +++ b/public/javascripts/des_kindEditor.js @@ -0,0 +1,136 @@ +function init_des_editor(params){ + // var minHeight; //最小高度 + var paramsHeight = params.height; //设定的高度 + var paramsWidth = params.width == undefined ? "100%" : params.width; + + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:paramsWidth, + height:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px", + minHeight:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + //nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + var edit = this.edit; + var body = edit.doc.body; + edit.iframe.height(paramsHeight); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, paramsHeight)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + edit.html(params.textarea.innerHTML); + var body = edit.doc.body; + paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; + edit.iframe.height(paramsHeight); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight), paramsHeight)); + + } + }).loadPlugin('paste'); + return editor; +} + +function nh_check_field(params){ + var result=true; + if(!check_org_title()) { + result=false; + return result; + } + if(params.content!=undefined){ + if(params.content.isEmpty()){ + result=false; + } + if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + params.textarea.html(params.content.html()); + params.content.sync(); + + if(params.content.isEmpty()){ + params.contentmsg.html('内容不能为空'); + params.contentmsg.css({color:'#ff0000'}); + }else{ + params.contentmsg.html('填写正确'); + params.contentmsg.css({color:'#008000'}); + } + } + } + return result; +} +function init_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = nh_check_field({ + issubmit:true, + //title:params.texttitle, + content:params.editor, + //titlemsg:params.titlemsg, + contentmsg:params.contentmsg, + textarea:params.textarea + }); + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); +} +function nh_reset_form(params){ + params.form[0].reset(); + params.texttitle.empty(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); + params.titlemsg.html(""); +} +//第二个参数是高度,可以传,可以不传 +function init_des_data(){ + var height = arguments[0] ? arguments[0] : undefined; + var width = arguments[1] ? arguments[1] : undefined; + KindEditor.ready(function (K) { + $("div[nhname='new_topic_form']").each(function () { + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form", params.div_form); + if (params.form == undefined || params.form.length == 0) { + return; + } + //params.texttitle = $("#document_title", params.div_form); + params.textarea = $("textarea[nhname='description_textarea']", params.div_form); + //params.titlemsg = $("#doc_title_hint", params.div_form); + params.contentmsg = $("#homework_course_id_span", params.div_form); + params.cancel_btn = $("#new_topic_cancel_btn"); + params.submit_btn = $("#new_topic_submit_btn"); + params.height = height; + params.width = width; + if (params.textarea.data('init') == undefined) { + params.editor = init_des_editor(params); + init_form(params); + params.cancel_btn.click(function () { + nh_reset_form(params); + }); + params.submit_btn.click(function () { + params.form.submit(); + }); + params.textarea.data('init', 1); + $(this).show(); + } + }); + }); +} \ No newline at end of file diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 45721fd1b..f652d0ce8 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -106,7 +106,46 @@ $(function(){ $('a.pic_date').on('click', function(){ $(this).parent().prev().first().focus(); }) - + + $("#NoticePopupBox").dialog({ + modal: true, + autoOpen: false, + dialogClass: 'BluePopupBox', + minWidth: 500 + }); + $('#NoticePopupBox').parent().resizable("disable"); + $('#NoticePopupBox').parent().removeClass("ui-state-disabled"); + $('#NoticePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); + $('a#switch_type').live('click', function(){ + if($("input[name=homework_type]").val() == "3"){ + $("#NoticePopupBox" ).dialog("close"); + $("input[name=homework_type]").val(1); + $('span.group_detail_info').text(''); + $("#group_setting a").removeClass("fontBlue2"); + $("#BluePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#BluePopupBox" ).dialog("close"); + }); + $('#textarea_input_test').focus(); + } else if($("input[name=homework_type]").val() == "2") { + $("#NoticePopupBox" ).dialog("close"); + $("input[name=homework_type]").val(1); + $('span.program_detail_info').text(""); + $("span.program_detail_info").removeClass("fontBlue2"); + $("#program_setting a").removeClass("fontBlue2"); + $("#GroupPopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.popClose").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $("#cancel_group").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $('#min_num').focus(); + } + }); + $("#BluePopupBox").dialog({ modal: true, @@ -117,14 +156,28 @@ $(function(){ $('#BluePopupBox').parent().resizable("disable"); $('#BluePopupBox').parent().removeClass("ui-state-disabled"); $('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); + $('#BluePopupBox').parent().css("position","fixed"); $('a.ProBtn').live('click', function(){ - $("#BluePopupBox").dialog("open"); - $(".ui-dialog-titlebar").hide(); - $("a.CloseBtn").on('click', function(){ - $("#BluePopupBox" ).dialog("close"); - }); - $('#textarea_input_test').focus(); + if($("input[name=homework_type]").val() == "3"){ + $("#NoticePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#cancel_switch").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#switch_homework_type_notice").text("您的作业类型将改为“分组作业”,并且您的编程设置将被清除。请问是否继续?"); + } + else { + $("#BluePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#BluePopupBox" ).dialog("close"); + }); + $('#textarea_input_test').focus(); + } }); var saveProgramAnswers = function() { @@ -161,7 +214,9 @@ $(function(){ if (valid) { $("input[name=homework_type]").val(2); - $('span.program_detail_info').text('('+language+','+test_numbers/2+'组测试)'); + $('span.program_detail_info').text('('+language+'语言,'+test_numbers/2+'组测试)'); + $("span.program_detail_info").addClass("fontBlue2"); + $("#program_setting a").addClass("fontBlue2"); //保存js值 var data = { language_type: $('select.language_type').val(), @@ -194,7 +249,7 @@ $(function(){ autoTextarea2(outputs[i], inputs[i]); } } - + $(inputs[inputs.length - 1]).focus(); }); $("#BluePopupBox").on('click', 'a.icon_remove', function(){ $(this).parent('.mt10').remove(); @@ -212,15 +267,28 @@ $(function(){ $('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.groupBtn').live('click', function(){ - $("#GroupPopupBox").dialog("open"); - $(".ui-dialog-titlebar").hide(); - $("a.popClose").on('click', function(){ - $("#GroupPopupBox" ).dialog("close"); - }); - $("#cancel_group").on('click', function(){ - $("#GroupPopupBox" ).dialog("close"); - }); - $('#min_num').focus(); + if($("input[name=homework_type]").val() == "2"){ + $("#NoticePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#cancel_switch").on('click', function(){ + $("#NoticePopupBox" ).dialog("close"); + }); + $("#switch_homework_type_notice").text("您的作业类型将改为“编程作业”,并且您的分组设置将被清除。请问是否继续?"); + } + else { + $("#GroupPopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.popClose").on('click', function () { + $("#GroupPopupBox").dialog("close"); + }); + $("#cancel_group").on('click', function () { + $("#GroupPopupBox").dialog("close"); + }); + $('#min_num').focus(); + } }); var saveGroupAttr = function() { @@ -244,6 +312,7 @@ $(function(){ if (valid) { $("input[name=homework_type]").val(3); $('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人'); + $("#group_setting a").addClass("fontBlue2"); //保存js值 var data = { base_on_project: base_on_project, @@ -258,7 +327,7 @@ $(function(){ return valid; }; - $("#GroupPopupBox a.group_btn").live('click', function(){ + $("#GroupPopupBox a.group_save_btn").live('click', function(){ if(saveGroupAttr()){ if($( "#GroupPopupBox" ).dialog( "isOpen" )){ $("#GroupPopupBox").dialog( "close" ); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index f273f0b77..b6301afad 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -75,7 +75,7 @@ function private_jour_submit(){ function jourReplyVerify() { var content = jour_content_editor.html();//$.trim($("#message_content").val()); if (jour_content_editor.isEmpty()) { - $("#jour_content_span").text("回复不能为空"); + $("#jour_content_span").text("留言不能为空"); $("#jour_content_span").css('color', '#ff0000'); $("#submit_feedback_user").one('click',function() { jour_submit(); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 1e3c68c83..a0052b97a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -513,7 +513,7 @@ a.exit { height:24px; display:block; width:80px; color:#000000; background:#c3c3 .st_list{ width:670px;} .st_search{ } .st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} -.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;} +.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;} .st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; } .st_search a:hover{ background:#048fbb; text-decoration:none;} .classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} diff --git a/public/stylesheets/images/close.png b/public/stylesheets/images/close.png index 301ba5e85..124685035 100644 Binary files a/public/stylesheets/images/close.png and b/public/stylesheets/images/close.png differ diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 26bf53c62..b9e1b40f7 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -195,6 +195,7 @@ a.c_green{ color:#28be6c;} .fontBlue {color:#3498db;} a.underline {text-decoration:underline;} a.fontBlue {color:#297fb8;} +.fontBlue2 {color:#269ac9 !important;} a.fontGrey {color:#cecece;} a.fontGrey2 {color:#888888;} a.linkOrange {color:#ff7143;} @@ -693,7 +694,9 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} -a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} +a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} @@ -1432,4 +1435,30 @@ span.at a{color:#269ac9;text-decoration: none;} .w80{ width:80px;} .label03{ width:70px; text-align:right; display:block; float:left;} .pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } -.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } \ No newline at end of file +.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } + +/*导入题库样式*/ +.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} +.subjectList {width:585px;} +.subjectDetail {width:385px;} +a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} +a.chooseActive {background-color:#269ac9; color:#ffffff;} +.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} +.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} +.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} +.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} +.subjectIntro {color:#585858; line-height:18px; font-size:12px;} +.subjectContent {color:#888888; line-height:18px; font-size:12px;} +.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} + +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 330cd5dc3..42a557010 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -23,7 +23,7 @@ a.saveBtn:hover {background-color:#297fb8;} .orgListUser {width:85px; float:left;} .orgListRole {width:180px; float:left;} .orgMemContainer {width:228px;} -.orgMemberAdd {float:right; width:240px;} +.orgMemberAdd {float:right;} .orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} .undis {display:none;} .dis {display:inline-block;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f1b0c5846..29c099d3d 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -414,7 +414,7 @@ a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !impor .st_list{ width:670px;} .st_search{ } .st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;} -.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;} +.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;} .st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; } .st_search a:hover{ background:#048fbb; text-decoration:none;} .classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} @@ -1167,4 +1167,4 @@ div.disable_link {background-color: #c1c1c1 !important;} /*问题跟踪局部修改属性*/ .proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} -.proInfoBox2 ul li{ height:24px; position:relative;} +.proInfoBox2 ul li{ height:24px; position:relative;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index abd2c10f9..285cac3bc 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -225,6 +225,7 @@ a.c_green{ color:#28be6c;} .fontGrey3 {color:#484848;} .fontGrey4{color:#999999;} .fontBlue {color:#3498db;} +.fontBlue2 {color:#269ac9 !important;} a.underline {text-decoration:underline;} a.fontBlue {color:#297fb8;} a.fontGrey {color:#cecece;} @@ -611,6 +612,8 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} /*a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}*/ /*a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;}*/ .homepagePostReplyPortrait {float:left; width:45px;} @@ -1017,3 +1020,29 @@ a:hover.userCancel{border:1px solid #888888; } .resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;} .relatePWrap{max-height: 210px;overflow:hidden;} + +/*导入题库样式*/ +.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} +.subjectList {width:585px;} +.subjectDetail {width:385px;} +a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} +a.chooseActive {background-color:#269ac9; color:#ffffff;} +.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} +.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} +.subjectName {width:270px; padding-left:10px; padding-right:10px;} +.subjectPublisher {width:80px; text-align:center;} +.subjectDate {width:80px; text-align:center;} +.subjectType {width:70px; text-align:center;} +.subjectCount {width:65px; text-align:center;} +.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} +.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} +.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} +.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} +.subjectIntro {color:#585858; line-height:18px; font-size:12px;} +.subjectContent {color:#888888; line-height:18px; font-size:12px;} +.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} + +.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} +.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}