From b68e227531bd4adcfeb834ea08dea3cb06276b83 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 22 Jun 2016 14:04:47 +0800 Subject: [PATCH 01/67] =?UTF-8?q?=E6=B2=A1=E6=BF=80=E6=B4=BB=E7=9A=84?= =?UTF-8?q?=E5=B8=90=E5=8F=B7=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 15 +- app/controllers/users_controller.rb | 6 + app/controllers/words_controller.rb | 20 +++ app/views/account/email_activation.html.erb | 52 ++++++ config/routes.rb | 5 +- public/stylesheets/header.css | 176 ++++++++++++++++++++ 6 files changed, 270 insertions(+), 4 deletions(-) create mode 100644 app/views/account/email_activation.html.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 33d988e35..8bf40d472 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -239,14 +239,21 @@ class AccountController < ApplicationController end def resendmail + status = 1 user = User.find(params[:user]) if params[:user] token = Token.new(:user => user, :action => "register") if token.save Mailer.run.register(token) - else yield if block_given? + status = 0 end + render :json => status + end + + def email_activation + + end private @@ -264,6 +271,7 @@ class AccountController < ApplicationController if user.nil? invalid_credentials elsif user.status == 2 + @user = user invalid_credentials_new elsif user.new_record? onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) @@ -375,8 +383,9 @@ class AccountController < ApplicationController def invalid_credentials_new logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" - flash[:error] = l(:notice_account_invalid_creditentials_new) - render signin_path(:login=>true) + # flash[:error] = l(:notice_account_invalid_creditentials_new) + # render signin_path(:login=>true) + render :action => 'email_activation' end # Register a user for email activation. diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 87c7d8f54..ed8a9fa36 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1239,6 +1239,12 @@ class UsersController < ApplicationController render :layout=>'new_base_user' end + #给某人留言 + def feedBackTo + + + end + def user_comments end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 22b7f1f52..3b540f0d0 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -337,6 +337,26 @@ class WordsController < ApplicationController UserExtensions.introduction(user, message) redirect_to user_url(user.id) end + + #邮箱激活问题留言 留言成功给出提示框 + def leave_email_activation_message + status = 1 #成功 + me = User.find(params[:user]) + if me + @user = User.find(params[:id]) + if params[:text].size>0 && @user + # @user.add_jour(me, params[:text]) + #私信 + message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
"+params[:text] + @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + else + status = 0 + end + render :json => status + else + render_403 + end + end private diff --git a/app/views/account/email_activation.html.erb b/app/views/account/email_activation.html.erb new file mode 100644 index 000000000..abd010a96 --- /dev/null +++ b/app/views/account/email_activation.html.erb @@ -0,0 +1,52 @@ +
+
+ + + <%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %> + +
+
+ diff --git a/config/routes.rb b/config/routes.rb index ec8fa2337..6e720ffba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -489,10 +489,13 @@ RedmineApp::Application.routes.draw do match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get match 'account/email_valid', :to => 'account#email_valid', :via => :get - match 'account/resendmail', :to => 'account#resendmail', :via=> :get + match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail' match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] + #激活邮箱反馈问题 + match 'users/:id/leave_email_activation_message', :to => 'words#leave_email_activation_message', :via => :get, :as => "leave_email_activation_message" + # boards match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message' match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields' diff --git a/public/stylesheets/header.css b/public/stylesheets/header.css index 767d76cb2..5700d0b00 100644 --- a/public/stylesheets/header.css +++ b/public/stylesheets/header.css @@ -117,3 +117,179 @@ a.f_grey:hover {color:#000000 !important;} #loginInButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;} #loginSignButton:hover {background-color:#297fb8;} #loginInButton:hover {background-color:#297fb8;} + +/* 邮箱验证 */ +.email_verify body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} +.mt30{ margin-top:30px;} +.ml30{ margin-left:30px;} +.new_content{ + width:1000px; + margin:10px auto; + padding:30px 0; + background-color:#fff; +} +.email_verify{ + width:720px; + margin:0px auto; +} +.email_verify_prompt{ + border:2px solid #dd0000; + background:#ffe3e3 url(../images/icons_prompt.png) 25px 10px no-repeat;; + height:35px; + line-height:35px; + padding-left:45px; + color:#8b0000; + font-size:14px; +} +.email_verify_btn{ + border-style:none; + height:35px; + padding:0 15px; + line-height:35px; + color:#fff; + background:#3a95d7; + text-align:center; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + font-size:14px; +} +.email_verify_btn:hover{ + background:#017bd3; +} +.email_sub_btn{ + border-style:none; + height:30px; + padding:0 25px; + line-height:30px; + color:#fff; + background:#3a95d7; + text-align:center; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + font-size:14px; +} +.email_sub_btn:hover{ + background:#017bd3; +} +.email_prompt_p{ + font-size:14px; + color:#000; + margin-bottom:10px; +} +.email_prompt_txt{ width:480px;} +.email_prompt_txt li{ + margin-left:15px; + list-style-type: disc; + color:#777; + line-height:1.9; + font-size:14px; +} +.email_prompt_mes{ + border:1px solid #ccc; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + width:468px; + height:60px; + background:#fff; + padding:5px; + margin-bottom: 5px; +} +.email_tanbox{ + border:2px solid #3a95d7; + background:#fff; + width:480px; + +} +.email_tancon{ + width:420px; + margin:0 auto; + text-align:center; + padding:20px 30px; + background:#fff; +} +.email_tan_title{ + font-size:18px; + color:#3a95d7; + font-weight:normal; + margin-bottom:5px; +} +.email_tan_p{ + font-size:14px; + color:#4c4c4c; + +} +.email_verify_p{ + font-size:14px; + color:#3a95d7; +} + +/***** Ajax indicator ******/ +/*-------resendmail---------*/ +#ajax-indicator { + position: absolute; /* fixed not supported by IE */ + background-color:#eee; + border: 1px solid #bbb; + top:35%; + left:40%; + width:20%; + font-weight:bold; + text-align:center; + padding:0.6em; + z-index:100000; + opacity: 0.5; +} + +html>body #ajax-indicator { position: fixed; } + +#ajax-indicator span { + background-position: 0% 40%; + background-repeat: no-repeat; + background-image: url(../images/loading.gif); + padding-left: 26px; + vertical-align: bottom; +} + +div.modal { + border-radius: 5px; + background: #fff; + z-index: 50; + padding: 4px; +} +.ui-widget-content { + border: 1px solid #ddd; + color: #333; +} +.ui-widget { + font-family: Verdana, sans-serif; + font-size: 1.1em; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; + zoom: 1; +} +.ui-widget-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-widget-overlay { + background: #666 url(http://forge.trustie.net/stylesheets/jquery/images/xui-bg_diagonals-thick_20_666666_40x40.png.pagespeed.ic.9mfuw_R0z1.png) 50% 50% repeat; + opacity: .5; + filter: Alpha(Opacity=50); +} +.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} +a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} +a:hover.Blue-btn{ background:#3598db; color:#fff;} +/***** end Ajax indicator ******/ \ No newline at end of file From 9461c41fa72bd1aadd835cc47903cab985bad9f2 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 22 Jun 2016 14:14:36 +0800 Subject: [PATCH 02/67] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E7=95=99=E8=A8=80?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 3 ++- app/views/account/email_activation.html.erb | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 3b540f0d0..1bbbb1190 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -343,7 +343,8 @@ class WordsController < ApplicationController status = 1 #成功 me = User.find(params[:user]) if me - @user = User.find(params[:id]) + #课程使者id=1 + @user = User.find(1) if params[:text].size>0 && @user # @user.add_jour(me, params[:text]) #私信 diff --git a/app/views/account/email_activation.html.erb b/app/views/account/email_activation.html.erb index abd010a96..d625e7fc9 100644 --- a/app/views/account/email_activation.html.erb +++ b/app/views/account/email_activation.html.erb @@ -10,7 +10,7 @@
  • 如果您无法收到激活邮件,请您直接给我们管理员留言:
  • - +
    @@ -29,7 +29,7 @@ } ); } - function leave_email_activation_message(url,user,id) + function leave_email_activation_message(url,user) { if ($(".email_prompt_mes").val().length == 0){ //弹框请他输入文字 @@ -39,7 +39,7 @@ } $.get( url, - {user:user,id: 1,text:$(".email_prompt_mes").val() }, + {user:user,text:$(".email_prompt_mes").val() }, function (data) { console.log("2222222"); console.log(data); From e818b5fb073f4c1ef02b9d321e8a05dee8aa8d3b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 24 Jun 2016 11:22:43 +0800 Subject: [PATCH 03/67] =?UTF-8?q?=E6=97=A7=E7=9A=84=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/account/register.html.erb | 127 ---------------------------- config/routes.rb | 2 +- 2 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 app/views/account/register.html.erb diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb deleted file mode 100644 index 0bebfdf5f..000000000 --- a/app/views/account/register.html.erb +++ /dev/null @@ -1,127 +0,0 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - - - -

    <%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

    - -<%= labelled_form_for @user, :url => register_path do |f| %> - <%= error_messages_for 'user' %> -
    - - <% if @user.auth_source_id.nil? %> -

    <%= f.text_field :login, :size => 25, :required => true %> - <%= l(:label_max_number) %> -

    -

    <%= f.password_field :password, :size => 25, :required => true %> - <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %> -

    -

    <%= f.password_field :password_confirmation, :size => 25, :required => true %>

    - <% end %> - -

    - <%= f.text_field :mail,:size => 25, :required => true %> - -

    -

    - -

    <%= "#{l(:label_mail_attention)} " %>

    -

    <%= "#{l(:label_mail_attention1)} " %>

    -
    -

    - - - - -
    - -

    - - - - -
    <%= submit_tag l(:button_submit) %>
    -

    -<% end %> -<% if Setting.openid? %> -

    <%= f.text_field :identity_url %>

    -<% end %> -<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> -

    <%= custom_field_tag_with_label :user, value %>

    -<% end %> - -<% password_min_length = Setting.password_min_length %> - \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 6e720ffba..8d822aafc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -484,7 +484,7 @@ RedmineApp::Application.routes.draw do match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] match 'agreement',:to => 'account#agreement',:as => 'agreement',:via=>[:get] match 'about_us',:to=>'account#about_us',:as=>'about_us',:via=>[:get] - match 'account/register', :via => [:get, :post], :as => 'register' + match 'account/register',:to=>'account#register', :via => [:get, :post], :as => 'register' match 'account/lost_password', :via => [:get, :post], :as => 'lost_password' match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get From 4a4c613c55c626c8a1cd4d3312674563f44a48af Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Jun 2016 19:38:08 +0800 Subject: [PATCH 04/67] =?UTF-8?q?utf-8=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/quality_analysis_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index e13882f6f..9c6c07109 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module QualityAnalysisHelper def sqale_rating_status val From 69f7dab04d68142a53c8953d43f77e21f09d6a0b Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 24 Jun 2016 21:33:35 +0800 Subject: [PATCH 05/67] some modified --- app/controllers/quality_analysis_controller.rb | 11 +++++++---- app/controllers/repositories_controller.rb | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 83e5960b9..6453ef5a8 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -21,11 +21,11 @@ class QualityAnalysisController < ApplicationController #@client.exists?(job_name) @g = Gitlab.client user_name = User.find(params[:user_id]).try(:login) - branch = params[:branch].nil? ? "master" : params[:branch] + branch = params[:branch].blank? ? "master" : params[:branch] language = params[:language] path = params[:path] identifier = params[:identifier] - qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first + qa = QualityAnalysis.where(:project_id => @project.id).first version = qa.nil? ? 1 : qa.sonar_version + 1 properties = "sonar.projectKey=#{user_name}:#{identifier} sonar.projectName=#{user_name}:#{identifier} @@ -42,16 +42,19 @@ class QualityAnalysisController < ApplicationController @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties # # replace config.xml of jenkins - @client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) + @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) # relace gitlab hook # genkins address @g.add_project_hook(@project.gpid, jenkins_address + "/project/#{user_name}_#{identifier}") - if qa.nil? + if qa.blank? QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language) else qa.update_attribute(:sonar_version, version) end + + # scan + @client.job.build("#{user_name}_#{identifier}") end def index diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cbb5b2f69..7c3acb2cc 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -20,6 +20,8 @@ require 'SVG/Graph/BarHorizontal' require 'digest/sha1' require 'redmine/scm/adapters/abstract_adapter' require 'tempfile' +require 'json' +require 'open-uri' class ChangesetNotFound < Exception; end class InvalidRevisionParam < Exception; end @@ -358,6 +360,11 @@ update end def show + # sonar_address = Redmine::Configuration['sonar_address'] + # projects_date = open(sonar_address + "/api/projects/index").read + # arr = JSON.parse(projects_date).map {|m| m["nm"]} + # arr.map + ## TODO: the below will move to filter, done. if !User.current.member_of?(@project) && @project.hidden_repo render_403 From e5b93ac7ed7c8cdad1e02d7a726f2e1730b712b8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 Jun 2016 18:13:46 +0800 Subject: [PATCH 06/67] modified main method --- .../quality_analysis_controller.rb | 109 +++++++++--------- app/helpers/quality_analysis_helper.rb | 38 +++--- app/views/quality_analysis/_show.html.erb | 20 ++-- app/views/repositories/show.html.erb | 8 +- ...0624103411_add_name_to_quality_analyses.rb | 5 - ...0316_add_sonar_name_to_quality_analyses.rb | 5 + db/schema.rb | 3 +- 7 files changed, 93 insertions(+), 95 deletions(-) delete mode 100644 db/migrate/20160624103411_add_name_to_quality_analyses.rb create mode 100644 db/migrate/20160627090316_add_sonar_name_to_quality_analyses.rb diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 6453ef5a8..9a5745dc1 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -1,6 +1,7 @@ class QualityAnalysisController < ApplicationController before_filter :find_project_by_project_id#, :except => [:getattachtype] before_filter :authorize + before_filter :connect_jenkins, :only => [:create] layout "base_projects" include ApplicationHelper require 'jenkins_api_client' @@ -13,74 +14,61 @@ class QualityAnalysisController < ApplicationController end def create - gitlab_address = Redmine::Configuration['gitlab_address'] - jenkins_address = Redmine::Configuration['jenkins_address'] - @client = JenkinsApi::Client.new(:server_url => jenkins_address, - :username => "temp", - :password => '123123') - #@client.exists?(job_name) - @g = Gitlab.client user_name = User.find(params[:user_id]).try(:login) - branch = params[:branch].blank? ? "master" : params[:branch] - language = params[:language] - path = params[:path] identifier = params[:identifier] - qa = QualityAnalysis.where(:project_id => @project.id).first - version = qa.nil? ? 1 : qa.sonar_version + 1 - properties = "sonar.projectKey=#{user_name}:#{identifier} + job_name = "#{user_name}:#{identifier}" + # Checks if the given job exists in Jenkins. + unless @client.job.exists?(job_name) + @g = Gitlab.client + branch = params[:branch].blank? ? "master" : params[:branch] + language = params[:language] + path = params[:path] + qa = QualityAnalysis.where(:project_id => @project.id).first + version = qa.nil? ? 1 : qa.sonar_version + 1 + properties = "sonar.projectKey=#{user_name}:#{identifier} sonar.projectName=#{user_name}:#{identifier} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} sonar.sourceEncoding=utf-8" - git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" - - # # # modify config - @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) - @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url - @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" - @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties - # - # replace config.xml of jenkins - @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) - # relace gitlab hook - # genkins address - @g.add_project_hook(@project.gpid, jenkins_address + "/project/#{user_name}_#{identifier}") - if qa.blank? - QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language) - - else - qa.update_attribute(:sonar_version, version) + git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" + # modify config.yml + @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) + @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url + @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" + @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties + @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) + # relace gitlab hook + @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{user_name}_#{identifier}") + # build job + opts = {'build_start_timeout' => 30, 'cancel_on_build_start_timeout' => true} + code = @client.job.build("#{user_name}_#{identifier}", opts) + # sucessed will return "201" + raise "Unable to build job: #{user_name}_#{identifier}" unless code == '201' + if qa.blank? && code == '201' + QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, + :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => job_name) + else + qa.update_attribute(:sonar_version, version) + end end - - # scan - @client.job.build("#{user_name}_#{identifier}") end def index @sonar_address = Redmine::Configuration['sonar_address'] - # if params[:resource_id].nil? - # @name_flag = true - # @quality_analyses = QualityAnalysis.where(:project_id => @project.id) - # # @quality_analyses.map {|qa| qa.} - # # if @quality_analyses.count > 0 - # # @quality_analyses.each do |qa| - # # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - # # - # # end - # # end - # # projects_date = open(@sonar_address + "/api/projects/index").read - # # arr = JSON.parse(projects_date).map {|m| m["nm"]} - # # arr.map - # else - qa = QualityAnalysis.where(:project_id => @project.id).first - @resource_id = qa.author_login+":"+qa.rep_identifier - @name_flag = false - complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read - @complexity =JSON.parse(complexity_date).first - issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read - @sonar_issues = JSON.parse(issue_date).first - # end + projects_date = open(@sonar_address + "/api/projects/index").read + arr = JSON.parse(projects_date).map {|m| m["nm"]} # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + if params[:resource_id].nil? + @quality_analyses = QualityAnalysis.where("sonar_name in #{arr}") + else + qa = QualityAnalysis.where(:project_id => @project.id).first + @resource_id = qa.author_login+":"+qa.rep_identifier + @name_flag = false + complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read + @complexity =JSON.parse(complexity_date).first + # issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read + # @sonar_issues = JSON.parse(issue_date).first + end end # Find project of id params[:project_id] @@ -99,4 +87,13 @@ class QualityAnalysisController < ApplicationController end end + def connect_jenkins + @gitlab_address = Redmine::Configuration['gitlab_address'] + @jenkins_address = Redmine::Configuration['jenkins_address'] + # connect jenkins + @client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => "temp", :password => '123123') + rescue + logger.error("failed to connect Jenkins") + end + end diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 9c6c07109..d2948e02b 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -3,19 +3,19 @@ module QualityAnalysisHelper def sqale_rating_status val arr = [] - if val.to_i > 0 && val.to_i < 5 + if val > 0 && val < 5 arr << "很好" arr << "b_green2" - elsif val.to_i > 5 && val.to_i < 10 + elsif val. > 5 && val < 10 arr << "较好" arr << "b_slow_yellow" - elsif val.to_i > 10 && val.to_i < 20 + elsif val > 10 && val < 20 arr << "中等" arr << "b_yellow" - elsif val.to_i > 20 && val.to_i < 50 + elsif val > 20 && val < 50 arr << "较差" arr << "b_slow_red" - elsif val.to_i > 20 + elsif val > 20 arr << "很差" arr << "b_red" end @@ -23,13 +23,13 @@ module QualityAnalysisHelper def complexity_status val arr = [] - if val.to_i < 10 + if val < 10 arr << "良好" arr << "b_green2" - elsif val.to_i > 10 && val.to_i < 15 + elsif val > 10 && val < 15 arr << "较高" arr << "b_yellow" - elsif val.to_i > 15 + elsif val > 15 arr << "很高" arr << "b_red" end @@ -37,13 +37,13 @@ module QualityAnalysisHelper def duplicated_lines_density_status val arr = [] - if val.to_i < 30 + if val < 30 arr << "良好" arr << "b_green2" - elsif val.to_i > 30 && val.to_i < 50 + elsif val > 30 && val < 50 arr << "较高" arr << "b_yellow" - elsif val.to_i > 50 + elsif val > 50 arr << "很高" arr << "b_red" end @@ -51,28 +51,28 @@ module QualityAnalysisHelper def comment_lines_density_status val arr = [] - if val.to_i < 20 + if val < 20 arr << "较低" arr << "b_yellow" - elsif val.to_i > 20 && val.to_i < 50 + elsif val > 20 && val < 50 arr << "正常" arr << "b_green2" - elsif val.to_i > 50 + elsif val > 50 arr << "较高" arr << "b_red" end end def score_sqale_rating val - if val.to_i > 0 && val.to_i < 5 + if val > 0 && val < 5 "5" - elsif val.to_i > 5 && val.to_i < 10 + elsif val > 5 && val < 10 "4" - elsif val.to_i > 10 && val.to_i < 20 + elsif val > 10 && val < 20 "3" - elsif val.to_i > 20 && val.to_i < 50 + elsif val > 20 && val < 50 "2" - elsif val.to_i > 20 + elsif val > 20 "1" end end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 8f1cb8443..864512bdd 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -1,8 +1,8 @@ <%= javascript_include_tag 'highcharts','highcharts-more' %> - <%= render :partial => "hightchars" %> -
    -

    质量分析

    -
    +<%= render :partial => "hightchars" %> +
    +

    质量分析

    +
    当前分支:<%= params[:branch] %>
    项目代码质量分析报告
    @@ -12,28 +12,28 @@

    质量等级

    -

    <%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>

    +

    <%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %>

    复杂度

    -

    <%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"])[0] %>

    +

    <%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"].to_i)[0] %>

    代码重复度

    -

    <%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[0] %>

    +

    <%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %>

    注释率

    -

    <%= @complexity["msr"][5]["frmt_val"] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"])[0] %>

    +

    <%= @complexity["msr"][5]["frmt_val"] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %>

    -
    质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"]) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
    +
    质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"].to_i) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
    技术债务<%= @complexity["msr"][8]["frmt_val"] %>查看详情
    质量问题 @@ -46,7 +46,7 @@
    信息<%= @sonar_issues["msr"][5]["frmt_val"] %>%;">
    -
    代码规模可定性评价为:<%= lines_scale(@complexity["msr"][0]["frmt_val"]) %>
    +
    代码规模可定性评价为:<%= lines_scale(@complexity["msr"][0]["frmt_val"].to_i) %>

    代码行数

    diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 124e3ef4d..5f4288262 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -2,13 +2,13 @@

    <%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>

    ZIP下载 - <% if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> <%# if User.current.member_of?(@project) %> <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> <%# end %> - <% else %> - <%= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> - <% end %> + <%# else %> + <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> + <%# end %>
    <% if @entries.nil? %> diff --git a/db/migrate/20160624103411_add_name_to_quality_analyses.rb b/db/migrate/20160624103411_add_name_to_quality_analyses.rb deleted file mode 100644 index bf61fd5ac..000000000 --- a/db/migrate/20160624103411_add_name_to_quality_analyses.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNameToQualityAnalyses < ActiveRecord::Migration - def change - add_column :quality_analyses, :language, :string - end -end diff --git a/db/migrate/20160627090316_add_sonar_name_to_quality_analyses.rb b/db/migrate/20160627090316_add_sonar_name_to_quality_analyses.rb new file mode 100644 index 000000000..c69b5c909 --- /dev/null +++ b/db/migrate/20160627090316_add_sonar_name_to_quality_analyses.rb @@ -0,0 +1,5 @@ +class AddSonarNameToQualityAnalyses < ActiveRecord::Migration + def change + add_column :quality_analyses, :sonar_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index ee2da177b..16f39f6a1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160624055127) do +ActiveRecord::Schema.define(:version => 20160627090316) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1844,6 +1844,7 @@ ActiveRecord::Schema.define(:version => 20160624055127) do t.string "path" t.string "branch" t.string "language" + t.string "sonar_name" end create_table "queries", :force => true do |t| From f930bbddad7eb88c1884878dade392e132627342 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 Jun 2016 09:45:45 +0800 Subject: [PATCH 07/67] modified create --- .../quality_analysis_controller.rb | 77 +++++++++++-------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 9a5745dc1..bff369eaf 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -14,43 +14,53 @@ class QualityAnalysisController < ApplicationController end def create - user_name = User.find(params[:user_id]).try(:login) - identifier = params[:identifier] - job_name = "#{user_name}:#{identifier}" - # Checks if the given job exists in Jenkins. - unless @client.job.exists?(job_name) - @g = Gitlab.client - branch = params[:branch].blank? ? "master" : params[:branch] - language = params[:language] - path = params[:path] - qa = QualityAnalysis.where(:project_id => @project.id).first - version = qa.nil? ? 1 : qa.sonar_version + 1 - properties = "sonar.projectKey=#{user_name}:#{identifier} + begin + user_name = User.find(params[:user_id]).try(:login) + identifier = params[:identifier] + # REDO + job_name = "#{user_name}:#{identifier}" + + # Checks if the given job exists in Jenkins. + unless @client.job.exists?(job_name) + @g = Gitlab.client + branch = params[:branch].blank? ? "master" : params[:branch] + language = params[:language] + path = params[:path] + qa = QualityAnalysis.where(:project_id => @project.id).first + version = qa.nil? ? 1 : qa.sonar_version + 1 + properties = "sonar.projectKey=#{user_name}:#{identifier} sonar.projectName=#{user_name}:#{identifier} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} sonar.sourceEncoding=utf-8" - git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" - # modify config.yml - @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) - @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url - @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" - @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties - @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) - # relace gitlab hook - @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{user_name}_#{identifier}") - # build job - opts = {'build_start_timeout' => 30, 'cancel_on_build_start_timeout' => true} - code = @client.job.build("#{user_name}_#{identifier}", opts) - # sucessed will return "201" - raise "Unable to build job: #{user_name}_#{identifier}" unless code == '201' - if qa.blank? && code == '201' - QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, - :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => job_name) - else - qa.update_attribute(:sonar_version, version) + git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" + + # modify config.yml + @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) + @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url + @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" + @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties + + # return '200' if successed + jenkins_job = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) + + # replace gitlab hook + @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{user_name}_#{identifier}") + # build job + logger.error("Test#{jenkins_job}") + + # return '201' if successed + code = @client.job.build("#{user_name}_#{identifier}") + if qa.blank? + QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, + :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => job_name) + else + qa.update_attribute(:sonar_version, version) + end end + rescue => e + puts e end end @@ -90,10 +100,11 @@ class QualityAnalysisController < ApplicationController def connect_jenkins @gitlab_address = Redmine::Configuration['gitlab_address'] @jenkins_address = Redmine::Configuration['jenkins_address'] + # connect jenkins @client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => "temp", :password => '123123') - rescue - logger.error("failed to connect Jenkins") + rescue => e + logger.error("failed to connect Jenkins ==> #{e}") end end From dd6b19a8b543234d1f9d2fa879a583bf3d1f4cb7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 Jun 2016 14:48:09 +0800 Subject: [PATCH 08/67] some status of sonar --- .../quality_analysis_controller.rb | 66 +++++++++++-------- app/models/quality_analysis.rb | 2 +- .../quality_analysis/_result_list.html.erb | 6 +- .../repositories/_quality_analysis.html.erb | 2 +- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index bff369eaf..7de4bedab 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -17,19 +17,20 @@ class QualityAnalysisController < ApplicationController begin user_name = User.find(params[:user_id]).try(:login) identifier = params[:identifier] + rep_id = params[:rep_id] # REDO - job_name = "#{user_name}:#{identifier}" + job_name = "#{user_name}-#{rep_id}" # Checks if the given job exists in Jenkins. unless @client.job.exists?(job_name) @g = Gitlab.client - branch = params[:branch].blank? ? "master" : params[:branch] + branch = params[:branch] language = params[:language] path = params[:path] - qa = QualityAnalysis.where(:project_id => @project.id).first + qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = qa.nil? ? 1 : qa.sonar_version + 1 - properties = "sonar.projectKey=#{user_name}:#{identifier} - sonar.projectName=#{user_name}:#{identifier} + properties = "sonar.projectKey=#{user_name}:#{rep_id} + sonar.projectName=#{user_name}:#{rep_id} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} @@ -43,18 +44,20 @@ class QualityAnalysisController < ApplicationController @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties # return '200' if successed - jenkins_job = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml) + jenkins_job = @client.job.create("#{job_name}", @doc.to_xml) # replace gitlab hook - @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{user_name}_#{identifier}") + @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") # build job - logger.error("Test#{jenkins_job}") - - # return '201' if successed - code = @client.job.build("#{user_name}_#{identifier}") - if qa.blank? + logger.error("Jenkins status of create ==> #{jenkins_job}") + # return '201' if build successed + code = @client.job.build("#{job_name}") + logger.error("build result ==> #{code}") + d = @client.delete("#{job_name}") if jenkins_job == '200' && code != '201' + logger.error("delete result ==> #{code}") + if qa.blank? && code == '201' QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, - :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => job_name) + :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}") else qa.update_attribute(:sonar_version, version) end @@ -62,23 +65,34 @@ class QualityAnalysisController < ApplicationController rescue => e puts e end + respond_to do |format| + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => "#{user_name}:#{rep_id}")} + format.js + end end + # resource_id: login + @repository.id def index - @sonar_address = Redmine::Configuration['sonar_address'] - projects_date = open(@sonar_address + "/api/projects/index").read - arr = JSON.parse(projects_date).map {|m| m["nm"]} # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - if params[:resource_id].nil? - @quality_analyses = QualityAnalysis.where("sonar_name in #{arr}") - else - qa = QualityAnalysis.where(:project_id => @project.id).first - @resource_id = qa.author_login+":"+qa.rep_identifier - @name_flag = false - complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read - @complexity =JSON.parse(complexity_date).first - # issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read - # @sonar_issues = JSON.parse(issue_date).first + begin + @resource_id = params[:resource_id] + @sonar_address = Redmine::Configuration['sonar_address'] + # projects_date = open(@sonar_address + "/api/projects/index").read + # @arr = JSON.parse(projects_date).map {|m| m["nm"]} # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + if params[:resource_id].nil? + @name_flag = true + # @quality_analyses = QualityAnalysis.where("sonar_name in (#{arr.empty? ? '0': arr.join(',')})") + @quality_analyses = QualityAnalysis.where(:project_id => @project.id) + else + qa = QualityAnalysis.where(:project_id => @project.id).first + complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read + @complexity =JSON.parse(complexity_date).first + issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read + @sonar_issues = JSON.parse(issue_date).first + end + rescue => e + puts e end + end # Find project of id params[:project_id] diff --git a/app/models/quality_analysis.rb b/app/models/quality_analysis.rb index 229be9826..8b8034c65 100644 --- a/app/models/quality_analysis.rb +++ b/app/models/quality_analysis.rb @@ -1,5 +1,5 @@ class QualityAnalysis < ActiveRecord::Base - attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language + attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language, :sonar_name def user_rep_name self.author_login+":"+self.rep_identifier diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index 507ded0fe..845049cea 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -6,17 +6,17 @@
  • 版本
  • 分支
  • 语言
  • -
  • 时间
  • +
  • lujing
  • <% if @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
      -
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %>
    • +
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %>
    • 1.0
    • <%= qa.branch %>
    • <%= qa.language %>
    • -
    • <%= format_time(qa.created_at) %>
    • +
    • <%= qa.path %>
    <% end %> diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb index f9726fb9b..0b3f38ee3 100644 --- a/app/views/repositories/_quality_analysis.html.erb +++ b/app/views/repositories/_quality_analysis.html.erb @@ -1,6 +1,6 @@
    代码质量分析
    - <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier), :remote => true, :id => 'quality_analyses_form') do %> + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :remote => true, :id => 'quality_analyses_form') do %>
    From 383483de269bdf40c739c9b911a257f6101bc39a Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 28 Jun 2016 15:13:04 +0800 Subject: [PATCH 09/67] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=9A=84=E5=B7=A6=E4=BE=A7=E6=A0=8Fbase=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2=E3=80=81=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=8F=AD=E7=BA=A7=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 + app/controllers/syllabuses_controller.rb | 37 +++- app/controllers/tags_controller.rb | 8 + app/helpers/courses_helper.rb | 16 ++ app/helpers/syllabuses_helper.rb | 3 + app/helpers/tags_helper.rb | 2 + app/models/syllabus.rb | 4 +- app/services/courses_service.rb | 1 + app/views/courses/new.html.erb | 20 ++- app/views/layouts/_syllabus_info.html.erb | 25 +++ app/views/layouts/_user_courses.html.erb | 4 +- app/views/layouts/base_syllabus.html.erb | 158 ++++++++++++++++++ app/views/layouts/new_base.html.erb | 2 +- app/views/layouts/new_base_user.html.erb | 5 +- app/views/syllabuses/new.html.erb | 27 +++ app/views/syllabuses/show.html.erb | 0 app/views/tags/_syllabus_tag.html.erb | 5 + .../tags/_tag_syllabus_new_name.html.erb | 28 ++++ app/views/tags/remove_tag.js.erb | 3 + app/views/tags/tag_save.js.erb | 4 + config/locales/zh.yml | 8 +- config/routes.rb | 12 ++ .../20160627074232_add_column_to_syllabus.rb | 12 ++ db/schema.rb | 26 ++- public/images/syllabus.jpg | Bin 0 -> 16760 bytes public/javascripts/course.js | 40 ++++- public/javascripts/syllabus.js | 9 + public/stylesheets/courses.css | 4 +- public/stylesheets/syllabus.css | 155 +++++++++++++++++ 29 files changed, 599 insertions(+), 20 deletions(-) create mode 100644 app/views/layouts/_syllabus_info.html.erb create mode 100644 app/views/layouts/base_syllabus.html.erb create mode 100644 app/views/syllabuses/new.html.erb create mode 100644 app/views/syllabuses/show.html.erb create mode 100644 app/views/tags/_syllabus_tag.html.erb create mode 100644 app/views/tags/_tag_syllabus_new_name.html.erb create mode 100644 db/migrate/20160627074232_add_column_to_syllabus.rb create mode 100644 public/images/syllabus.jpg create mode 100644 public/javascripts/syllabus.js create mode 100644 public/stylesheets/syllabus.css diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 7dea90e4b..e81251f63 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -715,6 +715,7 @@ class CoursesController < ApplicationController @trackers = Tracker.sorted.all @course = Course.new @course.safe_attributes = params[:course] + @syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first if params[:syllabus_id] # month = Time.now.month render :layout => 'new_base' else diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index 69982b99a..5ee3224bd 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -8,8 +8,43 @@ class SyllabusesController < ApplicationController end def show - @courses = @syllabus.courses + #@courses = @syllabus.courses + respond_to do |format| + format.js + format.html{render :layout => 'base_syllabus'} + format.api + end + end + + def new + if User.current.login? + @syllabus = Syllabus.new + render :layout => 'new_base' + else + redirect_to signin_url + end + end + def create + if User.current.user_extensions.identity + @syllabus = Syllabus.new + @syllabus.title = params[:title] + @syllabus.eng_name = params[:eng_name] + @syllabus.user_id = User.current.id + if @syllabus && @syllabus.save + respond_to do |format| + flash[:notice] = l(:notice_successful_create) + format.html {redirect_to syllabus_path(@syllabus)} + format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'syllabuses', :action => 'show', :id => @syllabus.id) } + end + else + respond_to do |format| + flash[:notice] = l(:notice_create_failed) + format.html { redirect_to new_syllabus_path } #Added by young + format.api { render_validation_errors(@syllabus) } + end + end + end end private diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 2c390025e..e66f88848 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -13,6 +13,7 @@ class TagsController < ApplicationController include ForumsHelper include AttachmentsHelper include ContestsHelper + include SyllabusesHelper include ActsAsTaggableOn::TagsHelper include TagsHelper include FilesHelper @@ -529,6 +530,8 @@ class TagsController < ApplicationController @obj = Course.find_by_id(@obj_id) when '10' @obj = Attachment.find_by_id(@obj_id) + when '11' + @obj = Syllabus.find_by_id(@obj_id) else @obj = nil end @@ -619,6 +622,9 @@ class TagsController < ApplicationController when '9' then @obj = Course.find_by_id(obj_id) @obj_pages, @courses_results, @results_count = for_pagination(get_courses_by_tag(selected_tags)) + when '11' then + @obj = Syllabus.find_by_id(obj_id) + @obj_pages, @syllabuses_results, @results_count = for_pagination(get_syllabuses_by_tag(selected_tags)) else @obj = nil end @@ -684,6 +690,8 @@ class TagsController < ApplicationController return 'Course' when '10' return 'Attachment' + when '11' + return 'Syllabus' else render_error :message => e.message return diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 47d343e8f..fd3be1369 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -667,6 +667,22 @@ module CoursesHelper is_current_term || is_next_term end + #课程大纲下拉框 + def syllabus_option + type = [] + option1 = [] + option1 << "请选择课程" + option1 << 0 + type << option1 + Syllabus.all.each do |syllabus| + option = [] + option << syllabus.title + option << syllabus.id + type << option + end + type + end + #获取课程动态 def get_course_activity courses, activities @course_ids=activities.keys() diff --git a/app/helpers/syllabuses_helper.rb b/app/helpers/syllabuses_helper.rb index dac84937b..d5284586e 100644 --- a/app/helpers/syllabuses_helper.rb +++ b/app/helpers/syllabuses_helper.rb @@ -1,2 +1,5 @@ module SyllabusesHelper + def get_syllabuses_by_tag(tag_name) + Syllabus.tagged_with(tag_name).order('updated_at desc') + end end diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 8847f4163..54753807d 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -23,6 +23,8 @@ module TagsHelper @obj= Course.find_by_id(obj_id) when '10' @obj = Attachment.find_by_id(obj_id) + when '11' + @obj = Syllabus.find_by_id(obj_id) else raise Exception, '[TagsHelper] ===> tag type unknow.' end diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb index 7d6319955..b1bdfd5aa 100644 --- a/app/models/syllabus.rb +++ b/app/models/syllabus.rb @@ -1,5 +1,7 @@ class Syllabus < ActiveRecord::Base + acts_as_taggable + belongs_to :user has_many :courses - attr_accessible :description, :title + attr_accessible :description, :title, :eng_name, :type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 60c053997..b7b5e73ac 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -201,6 +201,7 @@ class CoursesService #@course.safe_attributes(current_user,params[:course]) #@course.password = params[:course][:password] @course.tea_id = current_user.id + @course.syllabus_id = params[:syllabus_id].to_i @course.term = params[:term] @course.time = params[:time] @course.end_term = params[:end_term] diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index ddaf17ae8..d3326480f 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -4,12 +4,22 @@
      <%= labelled_form_for @course do |f| %> +
    • + + <% if @syllabus.nil? %> + <%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %> + <% else %> + <%=@syllabus.title %> + + <% end %> + + +
    • +
    • - - - +
    • @@ -49,13 +59,13 @@
    • - (选中后课外用户可见该课程,否则仅对课内成员可见) + (选中后班级外用户可见该班级,否则仅对班级内成员可见)
    • - (选中后课外用户可见学生列表,否则仅对课内成员可见) + (选中后班级外用户可见学生列表,否则仅对班级内成员可见)
    • diff --git a/app/views/layouts/_syllabus_info.html.erb b/app/views/layouts/_syllabus_info.html.erb new file mode 100644 index 000000000..4e7bc1f7b --- /dev/null +++ b/app/views/layouts/_syllabus_info.html.erb @@ -0,0 +1,25 @@ + +
      +

      <%=@syllabus.title %>

      +
      +
      +
      +
      +
      + <% if @syllabus.eng_name && !@syllabus.eng_name.empty? %> + <%= @syllabus.eng_name %> + <% else%> + 课程英文名称 + <% end %> + <% if User.current == @syllabus.user %> + <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_eng_name();"%> + <% end %> +
      +
      +
      + 教师(10| + 学生(10| + 资源(100
      +
      \ No newline at end of file diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index ff18e68bd..546a5b14b 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -47,7 +47,7 @@ <%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
    • - <% if User.current == @user %> + <% if User.current == user %>
    • +
    + +
    +
    + 班级 +
    +
      +
    • +
        +
      • + <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey"%> +
      • + +
      • + <%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%> +
      • +
      +
    • +
    +
    +
    + + <% courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %> +
    +
    +
      + <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current, :page => 0} %> + +
    +
    + <% if !courses.empty? %> +
    + +
    + <% end %> +
    +
    + +
    +

    标签:

    +
    + <%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%> +
    +
    +
    +
    访问计数 343 (自2016年5月)
    + +
    +
    + <%= yield %> +
    +
    + <%= render :partial => 'layouts/new_feedback' %> +
    +
    +<%= render :partial => 'layouts/footer' %> +
    + + + + + + diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb index e7695f0e7..4922882b9 100644 --- a/app/views/layouts/new_base.html.erb +++ b/app/views/layouts/new_base.html.erb @@ -13,7 +13,7 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> - <%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org'%> + <%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org', 'syllabus'%> <%= javascript_include_tag "course","header",'prettify' %> <%= yield :header_tags -%> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 8455d5693..9c816af7f 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -198,7 +198,10 @@
    • - <%= link_to "新建课程", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%> + <%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :class => "menuGrey"%> +
    • +
    • + <%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
    • diff --git a/app/views/syllabuses/new.html.erb b/app/views/syllabuses/new.html.erb new file mode 100644 index 000000000..34b02e33a --- /dev/null +++ b/app/views/syllabuses/new.html.erb @@ -0,0 +1,27 @@ +
      +

      新建课程

      +
      +
      +
        + <%= labelled_form_for @syllabus do |f| %> +
      • + + + +
      • +
        +
      • + + + +
      • +
        +
      • + 提交 + <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> +
        +
      • + <% end%> +
      +
      +
      \ No newline at end of file diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/tags/_syllabus_tag.html.erb b/app/views/tags/_syllabus_tag.html.erb new file mode 100644 index 000000000..4d6fc6b87 --- /dev/null +++ b/app/views/tags/_syllabus_tag.html.erb @@ -0,0 +1,5 @@ +
      +
      + <%= render :partial => "tags/tag_syllabus_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
      +
      \ No newline at end of file diff --git a/app/views/tags/_tag_syllabus_new_name.html.erb b/app/views/tags/_tag_syllabus_new_name.html.erb new file mode 100644 index 000000000..093e372ac --- /dev/null +++ b/app/views/tags/_tag_syllabus_new_name.html.erb @@ -0,0 +1,28 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% 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, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if obj.user == User.current %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> \ No newline at end of file diff --git a/app/views/tags/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index 4c4409c1c..b53aef949 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -19,6 +19,9 @@ $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', :locals => {:obj => @obj,:non_list_all => false, :object_flag => @object_flag}) %>'); +<% elsif @object_flag == '11'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_syllabus_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); <% else%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index e4f12b558..10b1393d8 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -38,6 +38,10 @@ $('#tags_name2').val(""); $('#tags_name').val(""); <% elsif @obj_flag == '10'%> //$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide(); +<% elsif @obj_flag == '11'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_syllabus_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name4').val(""); <% else%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3dbd2e8ef..41e70639c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -329,7 +329,7 @@ zh: permission_manage_subtasks: 管理子任务 permission_view_journals_for_messages: 查看留言 permission_view_courses: 查看课程 - permission_new_course: 新建课程 + permission_new_course: 新建班级 permission_configure_course: 配置课程 permission_close_course: 关闭/重开 permission_new_assignment: 新建任务 @@ -1265,7 +1265,9 @@ zh: label_delete_confirm: 确认删除? label_tags_bid: 需求名称 - label_tags_course_name: 课程名称 + label_tags_syllabus_name: 课程名称 + label_tags_course_name: 班级名称 + label_tags_course_eng_name: 英文名称 label_tags_bid_description: 需求描述 label_tags_issue_description: 问题描述 label_tags_all_objects: 所有 @@ -1692,7 +1694,7 @@ zh: label_new_join_group: 加入当前分班 label_new_course_password: 课程密码 label_new_course_school: 开课学校 - label_new_course_description: 课程描述 + label_new_course_description: 班级描述 label_homework_description: 作业描述 label_new_join_order: 请输入课程密码 label_task_submit_form_accessory: 作业最终以附件形式提交 diff --git a/config/routes.rb b/config/routes.rb index a0ab9b783..7e2998262 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1071,6 +1071,18 @@ RedmineApp::Application.routes.draw do match 'courses/search' match '/contests/search', :via => [:get, :post] + + #课程大纲路由设置 + resources :syllabuses do + member do + + end + + collection do + + end + end + # add by nwb # 课程路由设置 resources :courses do diff --git a/db/migrate/20160627074232_add_column_to_syllabus.rb b/db/migrate/20160627074232_add_column_to_syllabus.rb new file mode 100644 index 000000000..f907f7a31 --- /dev/null +++ b/db/migrate/20160627074232_add_column_to_syllabus.rb @@ -0,0 +1,12 @@ +class AddColumnToSyllabus < ActiveRecord::Migration + def change + add_column :syllabuses, :eng_name, :string + add_column :syllabuses, :type, :integer + add_column :syllabuses, :credit, :integer + add_column :syllabuses, :hours, :integer + add_column :syllabuses, :theory_hours, :integer + add_column :syllabuses, :practice_hours, :integer + add_column :syllabuses, :applicable_major, :string + add_column :syllabuses, :pre_course, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 148a6e21b..5147a5c73 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160624032138) do +ActiveRecord::Schema.define(:version => 20160627074232) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1539,6 +1539,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "quality_analyses", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + end + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1853,8 +1865,16 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.string "title" t.text "description" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "eng_name" + t.integer "type" + t.integer "credit" + t.integer "hours" + t.integer "theory_hours" + t.integer "practice_hours" + t.string "applicable_major" + t.string "pre_course" end add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" diff --git a/public/images/syllabus.jpg b/public/images/syllabus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3daef5a011ac6e10b3ceec2d28235c03a9febf02 GIT binary patch literal 16760 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 a0r~!>Y@zI4V$b!56QX)UIU^~YxBms9*~}{d literal 0 HcmV?d00001 diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 8b5e58618..fb272cfd0 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -182,10 +182,22 @@ function regex_course_password(str) return false; } } +//验证课程大纲 +function regex_syllabus_option(str) { + var obj = document.getElementById(str + "_syllabus_id"); + var syllabus = obj.options[obj.selectedIndex]; + if(parseInt(syllabus.value) == 0) { + $("#"+str+"_syllabus_notice").show(); + return false; + } else{ + $("#"+str+"_syllabus_notice").hide(); + return true; + } +} //提交新建课程 function submit_new_course() { - if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')) + if(regex_syllabus_option('new')&®ex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')) { $("#new_course").submit(); } @@ -193,11 +205,35 @@ function submit_new_course() function submit_edit_course(id) { - if(regex_course_name('edit')&®ex_course_class_period('edit')&®ex_time_term('edit')) + if(regex_syllabus_option('edit')&®ex_course_name('edit')&®ex_course_class_period('edit')&®ex_time_term('edit')) { $("#edit_course_"+id).submit(); } } + +//新建课程大纲 +function submit_new_syllabus() +{ + if(regex_syllabus_name()) + { + $("#new_syllabus").submit(); + } +} + +function regex_syllabus_name() { + var name = $.trim($("#new_syllabus_name").val()); + if(name.length < 2) + { + $("#new_syllabus_name_notice").show(); + return false; + } + else + { + $("#new_syllabus_name_notice").hide(); + return true; + } +} + //课程讨论区 function regexTopicSubject() { var name = $("#message_subject").val(); diff --git a/public/javascripts/syllabus.js b/public/javascripts/syllabus.js new file mode 100644 index 000000000..6483d266d --- /dev/null +++ b/public/javascripts/syllabus.js @@ -0,0 +1,9 @@ +//显示更多的班级 +function show_more_course(url){ + $.get( + url, + { page: $("#course_page_num").val() }, + function (data) { + } + ); +} diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index d0a5e7ab3..9bfc00625 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1426,4 +1426,6 @@ a.pages-big{ width:50px;} .H60 {height:60px !important;} .W420 {width:420px;} .W300 {width:300px !important;} -.W600{ width:600px;} +.W600{ width:600px;} + +.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;} \ No newline at end of file diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css new file mode 100644 index 000000000..cbdd5808f --- /dev/null +++ b/public/stylesheets/syllabus.css @@ -0,0 +1,155 @@ +/****标签(和资源库的tag样式一致)***/ +.project_Label{ width:218px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px; border:1px solid #dddddd;} +.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} +a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} +.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} +.re_tag{ width: auto; padding:0 5px; padding-top:2px; height:20px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } +.re_tag a{ color:#0d90c3;} +.tag_h{ } +.tag_h span,.tag_h a{ margin-bottom:5px;} +/*信息*/ +.project_info{ background:#fff; padding:10px 8px; width:222px; margin-bottom:10px; border:1px solid #dddddd;} +.pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;} +.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} +.pr_info_logo:hover{ border:1px solid #297fb8; } + +/*课程大纲*/ +input.syllabus_input{ + border:none; + width:150px; + height:25px; + line-height:25px; + color:#333; +} +input.syllabus_input_min{ + border:none; + width:30px; + height:25px; + line-height:25px; + color:#333; +} +.syllabus_select{ + border:1px solid #ccc; + margin-left:5px; +} +.syllabus_leftinfo { + margin:10px 10px 0 10px; + width:220px; +} +.syllabus_leftinfo li{ + line-height:25px; +} +.syllabus_leftinfo label{ + display:block; + width:60px; + text-align:right; + float:left; + line-height:25px; +} +.syllabusbox{ + position:relative; + width: 718px; + color: #4b4b4b; + padding:30px 15px; + margin-bottom: 10px; + background: #fff; + border: 1px solid #dddddd; +} +.syllabuscon_title{ + color:#000; text-align:center; +} +.syllabuscon_txt p{ + font-size:14px; + line-height:1.9; + color:#000; +} +.syllabuscon_txt_title{ + font-weight:bold; + margin:10px 0; +} +.syllabusbox_tishi{ + font-size:14px; + width:733px; + color:#cb7c01; + padding:10px 0 0 15px; + margin-bottom:10px; + background:#fff7d1; + border:1px solid #fcd9b4; + height:34px; +} +a.syllabusbox_a_blue{ + color:#3b94d6; +} +.syllabus_leftinfo p{ + line-height:25px; + width:150px; + overflow:hidden; + white-space: nowrap; + text-overflow:ellipsis; +} +.syllabus_info_tishi{ + font-size:16px; + width:400px; + margin:100px auto; +} +.syllabus_info_tishi a{ + color:#3b94d6; +} + +/*课程大纲-课程列表*/ +.icon_course{ background: url(../images/syllabus/icons_syllabus.png) 0 -35px no-repeat; width:18px; height:15px; display:block;} +.icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -53px no-repeat; width:20px; height:23px; display:block; cursor:pointer; } +.icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -53px no-repeat; width:20px; height:23px; display:block; } +.icons_sy_setting{background: url(../images/syllabus/icons_syllabus.png) -51px -33px no-repeat; width:20px; height:20px; display:block; } +.icons_sy_setting:hover{background: url(../images/syllabus/icons_syllabus.png) -25px -33px no-repeat; } +.icons_sy_cir{background: url(../images/syllabus/icons_syllabus.png) 0px -82px no-repeat; width:15px; height:15px; display:block; position:absolute; left:-8px; top:25px;} +.icons_sy_arrow{background: url(../images/syllabus/icons_syllabus.png) -31px -81px no-repeat; width:20px; height:20px; display:block; } +.syllabus_h2_top{ font-size:18px; color:#333; font-weight:normal; padding:10px 15px;border-bottom:1px solid #e7e7e7; } +.syllabus_category{ padding:10px 15px; background-color:#f6f6f6; border-bottom:1px solid #e7e7e7;} +.syllabus_box{ width:750px; border:1px solid #e7e7e7; background-color:#fff;} +.syllabus_courses_list{ padding:15px; border-bottom:1px solid #e7e7e7; cursor:pointer;} +.syllabus_courses_list:hover{ background:#f6fafd;} +.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.sy_p_grey{ margin-left:25px; color:#888; margin-top:5px; font-size:12px;} +.syllabus_class_box{ padding-left:30px; background:#f6f6f6;} +.syllabus_class_list{ padding:12px 0 12px 15px; height:44px;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7; position:relative;} +.syllabus_class_list:hover{ background:#ececec;} +.syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;} +.syllabus_class_list_more:hover{ background:#ececec;} +.syllabus_class_list_more a{ color:#ff7e00;} +.syllabus_class_title{ font-size:14px; color:#333; width:500px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.syllabus_class_w{ width:650px;} +.dis {display:block;} +.undis {display:none;} + +/*班级列表界面(用的博客列表的样式)*/ +.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } +.bloglistbox{ min-height:690px;} +.list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} +.category{ } +.list_title{padding:10px 0; border-bottom:1px solid #ddd;} +.category a,.category span{ float:left; margin-right:5px;} +.grayTxt{ color:#9093a6;} +.sortTxt{ color:#000;} +.sortTxt:hover{ color:#28be6c;} +a.sortupbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 3px no-repeat; width:12px; height:17px; display:block; margin-right:10px; cursor:pointer;} +a.sortdownbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } +a.sort_no{ background: url(../images/syllabus/icons_syllabus.png) -16px -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } +.item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;} +a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:708px;} +a:hover.list-title{ color:#269ac9;} +.c_red{ font-weight:normal; font-size:12px;} +.list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} +.list-file li{ line-height:1.9;} +.list-info span{ margin-left:5px;} +.pages a{ display:block; border:1px solid #d1d1d1; color:#888; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } +.pages a:hover{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} +a.pages-big{ width:50px;} +.pages .active{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} +.pages{width:330px; margin:20px auto 10px;} +a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} +a:hover.course-title{ color:#269ac9;} + +/*新建页面*/ +.name_input{ border:1px solid #64bdd9; height:16px; width:310px; background:#fff; margin-bottom:10px; padding:5px;} \ No newline at end of file From a08edcca8a6acdb1ab2d026916d52306460ec450 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 Jun 2016 17:18:50 +0800 Subject: [PATCH 10/67] quanxian --- app/controllers/quality_analysis_controller.rb | 9 +++++---- app/helpers/repositories_helper.rb | 5 +++++ app/views/projects/_development_group.html.erb | 6 ++++++ .../quality_analysis/_result_list.html.erb | 2 +- app/views/quality_analysis/_show.html.erb | 18 +++++++++--------- app/views/quality_analysis/create.js.erb | 1 + .../repositories/_quality_analysis.html.erb | 2 +- app/views/repositories/show.html.erb | 2 ++ public/stylesheets/public.css | 1 + 9 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 app/views/quality_analysis/create.js.erb diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 7de4bedab..591cef596 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -20,17 +20,19 @@ class QualityAnalysisController < ApplicationController rep_id = params[:rep_id] # REDO job_name = "#{user_name}-#{rep_id}" + sonar_name = "#{user_name}:#{rep_id}" # Checks if the given job exists in Jenkins. unless @client.job.exists?(job_name) @g = Gitlab.client branch = params[:branch] + logger.error("##################################{branch}") language = params[:language] path = params[:path] qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = qa.nil? ? 1 : qa.sonar_version + 1 - properties = "sonar.projectKey=#{user_name}:#{rep_id} - sonar.projectName=#{user_name}:#{rep_id} + properties = "sonar.projectKey=#{sonar_name} + sonar.projectName=#{sonar_name} sonar.projectVersion=#{version} sonar.sources=#{path} sonar.language=#{language.downcase} @@ -66,7 +68,7 @@ class QualityAnalysisController < ApplicationController puts e end respond_to do |format| - format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => "#{user_name}:#{rep_id}")} + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)} format.js end end @@ -83,7 +85,6 @@ class QualityAnalysisController < ApplicationController # @quality_analyses = QualityAnalysis.where("sonar_name in (#{arr.empty? ? '0': arr.join(',')})") @quality_analyses = QualityAnalysis.where(:project_id => @project.id) else - qa = QualityAnalysis.where(:project_id => @project.id).first complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read @complexity =JSON.parse(complexity_date).first issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 3cf781f76..b525c4aed 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -41,6 +41,11 @@ module RepositoriesHelper identifiers.include?(iden) ? false :true end + def quality_analysis login, rep_id + long_rep_id = "#{login}:#{rep_id}" + QualityAnalysis.where(:sonar_name => long_rep_id).first + end + # 获取文件目录的最新动态 def get_trees_last_changes(project_id, rev, ent_name) g = Gitlab.client diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 2c7d36fb5..6961fcbac 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -55,6 +55,12 @@ <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> <% end %>
  • + + <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + + <% end %> <% end %> diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index 845049cea..8c80d403f 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -12,7 +12,7 @@ <% if @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
      -
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %>
    • +
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %>
    • 1.0
    • <%= qa.branch %>
    • <%= qa.language %>
    • diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 864512bdd..4f8c21fe3 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -12,37 +12,37 @@

      质量等级

      -

      <%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %>

      +

      <%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %>

      复杂度

      -

      <%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"].to_i)[0] %>

      +

      <%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"].to_i)[0] %>

    代码重复度

    -

    <%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %>

    +

    <%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %>

    注释率

    -

    <%= @complexity["msr"][5]["frmt_val"] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %>

    +

    <%= @complexity["msr"][5]["frmt_val"] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %>

    质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"].to_i) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
    技术债务<%= @complexity["msr"][8]["frmt_val"] %>查看详情
    -
    质量问题 +
    质量问题 <%= @sonar_issues["msr"][0]["frmt_val"] %>问题分类如下:
    -
    阻断<%= @sonar_issues["msr"][1]["frmt_val"] %>%;">
    -
    严重<%= @sonar_issues["msr"][2]["frmt_val"] %>%;">
    -
    主要<%= @sonar_issues["msr"][3]["frmt_val"] %>%;">
    -
    次要<%= @sonar_issues["msr"][4]["frmt_val"] %>%;">
    +
    阻断<%= @sonar_issues["msr"][1]["frmt_val"] %>%;">
    +
    严重<%= @sonar_issues["msr"][2]["frmt_val"] %>%;">
    +
    主要<%= @sonar_issues["msr"][3]["frmt_val"] %>%;">
    +
    次要<%= @sonar_issues["msr"][4]["frmt_val"] %>%;">
    信息<%= @sonar_issues["msr"][5]["frmt_val"] %>%;">
    diff --git a/app/views/quality_analysis/create.js.erb b/app/views/quality_analysis/create.js.erb new file mode 100644 index 000000000..f6955106f --- /dev/null +++ b/app/views/quality_analysis/create.js.erb @@ -0,0 +1 @@ +<% %> \ No newline at end of file diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb index 0b3f38ee3..e0240c257 100644 --- a/app/views/repositories/_quality_analysis.html.erb +++ b/app/views/repositories/_quality_analysis.html.erb @@ -1,6 +1,6 @@
    代码质量分析
    - <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :remote => true, :id => 'quality_analyses_form') do %> + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :id => 'quality_analyses_form') do %>
    diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 5f4288262..6bc01c83c 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -4,7 +4,9 @@ ZIP下载 <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> <%# if User.current.member_of?(@project) %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> + <% end %> <%# end %> <%# else %> <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 743c81014..2ab150405 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -28,6 +28,7 @@ h2{ font-size:18px; } h3{ font-size:14px; } h4{ font-size:14px; } .f8 {font-size:8px;} +.f10 {font-size:10px;} .f12{font-size:12px; font-weight:normal;} .f14{font-size:14px;} .f16{font-size:16px;} From 300ad6840537cc2ea92bac3f183e1951d7b6e5c5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 Jun 2016 17:39:58 +0800 Subject: [PATCH 11/67] default path for sonar --- .../quality_analysis_controller.rb | 3 +-- app/views/repositories/show.html.erb | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 591cef596..7b0bc5327 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -26,9 +26,8 @@ class QualityAnalysisController < ApplicationController unless @client.job.exists?(job_name) @g = Gitlab.client branch = params[:branch] - logger.error("##################################{branch}") language = params[:language] - path = params[:path] + path = params[:path].nil? ? "./" :params[:path] qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = qa.nil? ? 1 : qa.sonar_version + 1 properties = "sonar.projectKey=#{sonar_name} diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 6bc01c83c..0f179d150 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -1,16 +1,18 @@ <%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>

    <%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>

    - ZIP下载 - <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%# if User.current.member_of?(@project) %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> - <% end %> - <%# end %> - <%# else %> + <% unless @entries.nil? %> + ZIP下载 + <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%# if User.current.member_of?(@project) %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> + <% end %> + <%# end %> + <%# else %> <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> - <%# end %> + <%# end %> + <% end %>
    <% if @entries.nil? %> From 222855ea796e9ea30321f18b834775c2ffcd350e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 28 Jun 2016 19:19:59 +0800 Subject: [PATCH 12/67] =?UTF-8?q?=E8=B6=8A=E8=BF=87course=E8=A1=A8?= =?UTF-8?q?=E7=9A=84validate,=E4=BB=A5=E9=98=B2save=20invitecode=20?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 6 +++++- app/models/course.rb | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b482cb6fd..eef93c371 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,11 @@ source 'https://ruby.taobao.org/' unless RUBY_PLATFORM =~ /w32/ # unix-like only gem 'iconv' - gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel + if RUBY_PLATFORM =~ /darwin/ + gem "rmagick", "= 2.15.4" ## osx must be this version + else + gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel + end gem 'certified' end diff --git a/app/models/course.rb b/app/models/course.rb index f286a2443..0c4acce97 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -470,8 +470,7 @@ class Course < ActiveRecord::Base if !code || code.size <5 code = CODES.sample(5).join return generate_invite_code if Course.where(invite_code: code).present? - self[:invite_code] = code - save! && reload + update_attribute(:invite_code, code) end code end From 0a684227b8d58fa2d6a6b1766dc4a9b22df4e45a Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 28 Jun 2016 22:01:44 +0800 Subject: [PATCH 13/67] =?UTF-8?q?=E5=A6=82=E6=9E=9Csonar=E6=B2=A1=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=AE=8C=E6=88=90=E5=88=99=E6=9A=82=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/quality_analysis_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 7b0bc5327..40e1c81de 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -77,12 +77,12 @@ class QualityAnalysisController < ApplicationController begin @resource_id = params[:resource_id] @sonar_address = Redmine::Configuration['sonar_address'] - # projects_date = open(@sonar_address + "/api/projects/index").read - # @arr = JSON.parse(projects_date).map {|m| m["nm"]} # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] if params[:resource_id].nil? @name_flag = true - # @quality_analyses = QualityAnalysis.where("sonar_name in (#{arr.empty? ? '0': arr.join(',')})") - @quality_analyses = QualityAnalysis.where(:project_id => @project.id) + projects_date = open(@sonar_address + "/api/projects/index").read + arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + quality_analyses = QualityAnalysis.where(:project_id => @project.id) + @quality_analyses.collect{|qa| arr.include?(qa.sonar_name)} else complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read @complexity =JSON.parse(complexity_date).first From c24fdee13464843ca86f393f9737ae1df79a1ddb Mon Sep 17 00:00:00 2001 From: Linda <2294690300@qq.com> Date: Wed, 29 Jun 2016 08:48:13 +0800 Subject: [PATCH 14/67] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=B0=E7=89=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/views/my/account.html.erb | 47 +++++++++++------------------------ 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/Gemfile b/Gemfile index d392c6561..a1ea263f5 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end -gem 'certified' +# gem 'certified' gem 'wechat',path: 'lib/wechat' gem 'grack', path:'lib/grack' diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 9cca5da5c..f28ad1ca2 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -15,14 +15,13 @@ <%= error_messages_for 'user',@user.user_extensions %> <% end %>
      -
    • 登录名 : *
    • -
    • 邮箱 : *
    • -
    • 身份 : *
    • -
    • 姓(Last Name) : *
    • -
    • 名(First Name) : *
    • +
    • *  登录名 : 
    • +
    • *  邮箱 : 
    • +
    • *  职业 : 
    • +
    • *  姓名 : 
    • 组织名 : *
    • 性别 : 
    • -
    • 工作单位 : 
    • +
    • 单位名称 : 
    • 地区 : 
    • 邮件通知 : 
    • @@ -66,34 +65,18 @@
    • <%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> -
    • <%= f.text_field :firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> +
    • <%= text_field_tag :enterprise_name,@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
    • - + +
    • -
    • - <% if User.current.user_extensions.nil? %> - - - - - <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - - - - - <% elsif User.current.user_extensions.school.nil? %> - - - - - <% else %> - - - - - <% end %> +
    • + +

      您输入的名称尚不存在,申请添加

    • @@ -140,13 +123,13 @@
    • <%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %> - +
    • <%= f.select :language, :Chinese => :zh, :English => :en %>
    • - 确认 + 确定
    • From 22b40c082cd71de2873af3136437908a10f8d1af Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 Jun 2016 09:10:47 +0800 Subject: [PATCH 15/67] resole some nil problems --- .../quality_analysis_controller.rb | 2 +- .../quality_analysis/_hightchars.html.erb | 6 +- app/views/quality_analysis/_show.html.erb | 94 +++++++++++-------- app/views/repositories/show.html.erb | 4 +- 4 files changed, 62 insertions(+), 44 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 7b0bc5327..9ea602659 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -27,7 +27,7 @@ class QualityAnalysisController < ApplicationController @g = Gitlab.client branch = params[:branch] language = params[:language] - path = params[:path].nil? ? "./" :params[:path] + path = params[:path].blank? ? "./" : params[:path] qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = qa.nil? ? 1 : qa.sonar_version + 1 properties = "sonar.projectKey=#{sonar_name} diff --git a/app/views/quality_analysis/_hightchars.html.erb b/app/views/quality_analysis/_hightchars.html.erb index fb60eaed3..278851ad5 100644 --- a/app/views/quality_analysis/_hightchars.html.erb +++ b/app/views/quality_analysis/_hightchars.html.erb @@ -209,7 +209,7 @@ }, series: [{ name: '复杂度', - data: [<%= @complexity["msr"][6]["val"] %>] + data: [<%= @complexity["msr"][6].nil? ? 0 : @complexity["msr"][6]["val"] %>] // tooltip: { // valueSuffix: ' km/h' // } @@ -329,7 +329,7 @@ }, series: [{ name: '重复率', - data: [<%= @complexity["msr"][7]["val"] %>] + data: [<%= @complexity["msr"][7].nil? ? 0 : @complexity["msr"][7]["val"] %>] // tooltip: { // valueSuffix: ' km/h' // } @@ -454,7 +454,7 @@ }, series: [{ name: '质量等级', - data: [<%= @complexity["msr"][5]["val"] %>] + data: [<%= @complexity["msr"][5].nil? ? 0 : @complexity["msr"][5]["val"] %>] // tooltip: { // valueSuffix: ' km/h' // } diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 4f8c21fe3..0a522df52 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -1,5 +1,4 @@ <%= javascript_include_tag 'highcharts','highcharts-more' %> -<%= render :partial => "hightchars" %>

      质量分析

      @@ -7,66 +6,85 @@
      项目代码质量分析报告
      概要信息
      -
      -
      -
      -

      -

      质量等级

      -

      <%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %>

      +<% if @complexity["msr"].count > 3 %> + <%= render :partial => "hightchars" %> +
      +
      +
      +

      +

      质量等级

      +

      <%= @complexity["msr"][9].nil? ? 0 : @complexity["msr"][9]["frmt_val"] %> + borderRadius"><%= @complexity["msr"][9].nil? ? 0 : sqale_rating_status(@complexity["msr"][9]["val"].to_i)[0] %>

      +
      +
      +

      +

      复杂度

      +

      <%= @complexity["msr"][6].nil? ? 0 : @complexity["msr"][6]["val"] %> + borderRadius"><%= @complexity["msr"][6].nil? ? 0 : complexity_status(@complexity["msr"][6]["val"].to_i)[0] %>

      +
      -
      -

      -

      复杂度

      -

      <%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"].to_i)[0] %>

      +
      +
      +

      +

      代码重复度

      +

      <%= @complexity["msr"][7].nil? ? 0 : @complexity["msr"][7]["frmt_val"] %> + borderRadius"><%= @complexity["msr"][7].nil? ? 0 : duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %>

      +
      +
      +

      +

      注释率

      +

      <%= @complexity["msr"][5].nil? ? 0 : @complexity["msr"][5]["frmt_val"] %> + borderRadius"><%= @complexity["msr"][5].nil? ? 0 : comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %>

      +
      -
      -
      -

      -

      代码重复度

      -

      <%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"].to_i)[0] %>

      -
      -
      -

      -

      注释率

      -

      <%= @complexity["msr"][5]["frmt_val"] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"].to_i)[0] %>

      -
      -
      -
      -
      质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"].to_i) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
      +<% end %> + +
      质量等级<%=@complexity["msr"][9].nil? ? 0 : score_sqale_rating(@complexity["msr"][9]["val"].to_i) %>/5分 + 可定性评价为:质量<%=@complexity["msr"][9].nil? ? 0 : sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
      -
      技术债务<%= @complexity["msr"][8]["frmt_val"] %>查看详情
      +
      技术债务<%=@complexity["msr"][8].nil? ? 0 : @complexity["msr"][8]["frmt_val"] %> + 查看详情
      质量问题 - <%= @sonar_issues["msr"][0]["frmt_val"] %>问题分类如下:
      + <%=@sonar_issues["msr"][0].nil? ? 0 : @sonar_issues["msr"][0]["frmt_val"] %>问题分类如下:
      -
      阻断<%= @sonar_issues["msr"][1]["frmt_val"] %>%;">
      -
      严重<%= @sonar_issues["msr"][2]["frmt_val"] %>%;">
      -
      主要<%= @sonar_issues["msr"][3]["frmt_val"] %>%;">
      -
      次要<%= @sonar_issues["msr"][4]["frmt_val"] %>%;">
      -
      信息<%= @sonar_issues["msr"][5]["frmt_val"] %>%;">
      +
      阻断 + <%= @sonar_issues["msr"][1].nil? ? 0 : @sonar_issues["msr"][1]["frmt_val"] %> + %;">
      +
      严重 + <%= @sonar_issues["msr"][2].nil? ? 0 : @sonar_issues["msr"][2]["frmt_val"] %> + %;">
      +
      主要 + <%= @sonar_issues["msr"][3].nil? ? 0 : @sonar_issues["msr"][3]["frmt_val"] %> + %;">
      +
      次要 + <%=@sonar_issues["msr"][4].nil? ? 0 : @sonar_issues["msr"][4]["frmt_val"] %> + %;">
      +
      信息 + <%=@sonar_issues["msr"][5].nil? ? 0 : @sonar_issues["msr"][5]["frmt_val"] %>%;">
      -
      代码规模可定性评价为:<%= lines_scale(@complexity["msr"][0]["frmt_val"].to_i) %>
      +
      代码规模可定性评价为:<%=@complexity["msr"][0].nil? ? 0 : lines_scale(@complexity["msr"][0]["frmt_val"].to_i) %>

      代码行数

      -

      <%= @complexity["msr"][0]["frmt_val"] %>

      +

      <%= @complexity["msr"][0].nil? ? 0 : @complexity["msr"][0]["frmt_val"] %>

      文件

      -

      <%= @complexity["msr"][2]["frmt_val"] %>

      +

      <%= @complexity["msr"][2].nil? ? 0 : @complexity["msr"][2]["frmt_val"] %>

      目录

      -

      <%= @complexity["msr"][3]["frmt_val"] %>

      +

      <%= @complexity["msr"][3].nil? ? 0 : @complexity["msr"][3]["frmt_val"] %>

      -

      <%= @complexity["msr"][1]["frmt_val"] %>

      +

      <%= @complexity["msr"][1].nil? ? 0 : @complexity["msr"][1]["frmt_val"] %>

      方法

      -

      <%= @complexity["msr"][4]["frmt_val"] %>

      +

      <%=@complexity["msr"][4].nil? ? 0 : @complexity["msr"][4]["frmt_val"] %>

      diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 0f179d150..92769dbbe 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -5,9 +5,9 @@ ZIP下载 <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> <%# if User.current.member_of?(@project) %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> - <% end %> + <%# end %> <%# end %> <%# else %> <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> From c151a619800cd63dc62995b5d71496d92abe67bc Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 29 Jun 2016 09:14:53 +0800 Subject: [PATCH 16/67] =?UTF-8?q?=E6=8A=8A=E5=87=A0=E4=B8=AAgem=E5=8C=85?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=94=BE=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index eef93c371..bb94100a5 100644 --- a/Gemfile +++ b/Gemfile @@ -9,12 +9,11 @@ unless RUBY_PLATFORM =~ /w32/ gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel end gem 'certified' + gem 'net-ssh', '2.9.1' + gem 'jenkins_api_client' + gem 'nokogiri' end -gem 'net-ssh', '2.9.1' -gem 'jenkins_api_client' -gem 'nokogiri' - gem 'wechat',path: 'lib/wechat' gem 'grack', path:'lib/grack' gem 'gitlab', path: 'lib/gitlab-cli' From e887ac5c7c500b91d29522c47483e67316c10eaf Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 Jun 2016 09:38:30 +0800 Subject: [PATCH 17/67] git data from sonar --- app/controllers/quality_analysis_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index eb20426e3..ceac41399 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -66,10 +66,10 @@ class QualityAnalysisController < ApplicationController rescue => e puts e end - respond_to do |format| - format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)} - format.js - end + # respond_to do |format| + # format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)} + # format.js + # end end # resource_id: login + @repository.id @@ -81,8 +81,8 @@ class QualityAnalysisController < ApplicationController @name_flag = true projects_date = open(@sonar_address + "/api/projects/index").read arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - quality_analyses = QualityAnalysis.where(:project_id => @project.id) - @quality_analyses.collect{|qa| arr.include?(qa.sonar_name)} + @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} + else complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read @complexity =JSON.parse(complexity_date).first From c8178fc02370d7046ed474dd75cd3b5702a2444e Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 Jun 2016 09:59:21 +0800 Subject: [PATCH 18/67] allert --- app/controllers/quality_analysis_controller.rb | 15 ++++++++++++++- app/views/quality_analysis/create.js.erb | 2 +- app/views/repositories/_quality_analysis.html.erb | 4 ++-- app/views/repositories/show.html.erb | 6 +++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index ceac41399..852277126 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -26,7 +26,7 @@ class QualityAnalysisController < ApplicationController unless @client.job.exists?(job_name) @g = Gitlab.client branch = params[:branch] - language = params[:language] + language = swith_language_type(params[:language]) path = params[:path].blank? ? "./" : params[:path] qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = qa.nil? ? 1 : qa.sonar_version + 1 @@ -72,6 +72,19 @@ class QualityAnalysisController < ApplicationController # end end + # get language type + def swith_language_type language + if language = "c#" + "cs" + elsif language = "python" + "py" + elsif language = "c" + "c++" + else + language + end + end + # resource_id: login + @repository.id def index begin diff --git a/app/views/quality_analysis/create.js.erb b/app/views/quality_analysis/create.js.erb index f6955106f..4bb632b43 100644 --- a/app/views/quality_analysis/create.js.erb +++ b/app/views/quality_analysis/create.js.erb @@ -1 +1 @@ -<% %> \ No newline at end of file +alert("dengdai") \ No newline at end of file diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb index e0240c257..b6eb62124 100644 --- a/app/views/repositories/_quality_analysis.html.erb +++ b/app/views/repositories/_quality_analysis.html.erb @@ -1,6 +1,6 @@
      代码质量分析
      - <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :id => 'quality_analyses_form') do %> + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id, :remote => true), :id => 'quality_analyses_form') do %>
      @@ -12,7 +12,7 @@
      - <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#", "Web"]), :id => 'branch', :class => "analysis-option-box" %> + <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %>
      diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 92769dbbe..b524e898f 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -5,9 +5,9 @@ ZIP下载 <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> <%# if User.current.member_of?(@project) %> - <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> - <%# end %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> + <% end %> <%# end %> <%# else %> <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %> From 36944e8cce43be6b5c08917b26ee8ca91057321b Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 29 Jun 2016 10:06:23 +0800 Subject: [PATCH 19/67] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/quality_analysis/create.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/quality_analysis/create.js.erb b/app/views/quality_analysis/create.js.erb index 4bb632b43..8f93f86ee 100644 --- a/app/views/quality_analysis/create.js.erb +++ b/app/views/quality_analysis/create.js.erb @@ -1 +1 @@ -alert("dengdai") \ No newline at end of file +alert("正在分析中…………(大概需要30分钟,请耐心等待)") \ No newline at end of file From e0664450364ca5d571942d2c37eeb3ac8d09fa28 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 29 Jun 2016 10:45:56 +0800 Subject: [PATCH 20/67] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E5=92=8C=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/syllabuses_controller.rb | 28 +++++--- app/controllers/users_controller.rb | 10 ++- app/helpers/owner_type_helper.rb | 3 +- app/models/attachment.rb | 1 + app/models/course.rb | 3 +- app/models/syllabus.rb | 9 +++ app/services/courses_service.rb | 1 + app/views/courses/_copy_course.html.erb | 18 +++--- app/views/courses/new.html.erb | 3 +- app/views/courses/settings.html.erb | 25 ++++---- app/views/layouts/_project_info.html.erb | 32 ++++----- app/views/layouts/_user_courses.html.erb | 4 +- app/views/layouts/base_courses.html.erb | 7 +- app/views/layouts/base_syllabus.html.erb | 47 ++++++++------ app/views/layouts/new_base_user.html.erb | 3 +- app/views/syllabuses/edit.html.erb | 82 ++++++++++++++++++++++++ app/views/syllabuses/show.html.erb | 44 +++++++++++++ app/views/users/user_courses4show.js.erb | 2 +- config/locales/courses/zh.yml | 4 +- public/javascripts/syllabus.js | 22 +++++++ 20 files changed, 262 insertions(+), 86 deletions(-) create mode 100644 app/views/syllabuses/edit.html.erb diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index 5ee3224bd..7e4e5cea8 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -1,7 +1,7 @@ class SyllabusesController < ApplicationController - before_filter :is_logged, :only => [:index, :show] - before_filter :find_syllabus, :only => [:show] + before_filter :is_logged, :only => [:index, :show, :edit, :new, :update] + before_filter :find_syllabus, :only => [:show, :edit, :update] def index user = User.current @syllabuses = user.syllabuses @@ -17,12 +17,8 @@ class SyllabusesController < ApplicationController end def new - if User.current.login? - @syllabus = Syllabus.new - render :layout => 'new_base' - else - redirect_to signin_url - end + @syllabus = Syllabus.new + render :layout => 'new_base' end def create @@ -47,6 +43,22 @@ class SyllabusesController < ApplicationController end end + def edit + respond_to do |format| + format.html{render :layout => 'base_syllabus'} + end + end + + def update + @syllabus.description = params[:syllabus][:description] + @syllabus.save_attachments(params[:attachments]) + if @syllabus.save + redirect_to syllabus_path(@syllabus) + else + redirect_to syllabus_path(@syllabus) + end + end + private def find_syllabus @syllabus = Syllabus.find params[:id] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b7972ff6f..39a2ae5a5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1367,7 +1367,15 @@ class UsersController < ApplicationController #显示更多用户课程 def user_courses4show @page = params[:page].to_i + 1 - @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @type = params[:type] + if @type == 'User' + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @all_count = @user.courses.visible.where("is_delete =?", 0).count + elsif @type == 'Syllabus' + @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first + @courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count + end end #显示更多用户项目 diff --git a/app/helpers/owner_type_helper.rb b/app/helpers/owner_type_helper.rb index 7119d4f60..01320660c 100644 --- a/app/helpers/owner_type_helper.rb +++ b/app/helpers/owner_type_helper.rb @@ -7,5 +7,6 @@ module OwnerTypeHelper BID = 6 JOURNALSFORMESSAGE = 7 HOMEWORKCOMMON = 8 - BLOGCOMMENT=9 + BLOGCOMMENT = 9 + SYLLABUS = 10 end \ No newline at end of file diff --git a/app/models/attachment.rb b/app/models/attachment.rb index aa4ef8670..88fadd644 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -24,6 +24,7 @@ class Attachment < ActiveRecord::Base belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'" belongs_to :organization, foreign_key: 'container_id', conditions: "attachements.container_type = 'Organization'" + belongs_to :syllabus, foreign_key: 'container_id', conditions: "attachements.container_type = 'Syllabus'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" diff --git a/app/models/course.rb b/app/models/course.rb index 195e7cf9f..7420e653f 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -90,7 +90,8 @@ class Course < ActiveRecord::Base 'description', 'class_period', 'open_student', - 'is_delete' + 'is_delete', + 'syllabus_id' acts_as_customizable diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb index b1bdfd5aa..e16577ff3 100644 --- a/app/models/syllabus.rb +++ b/app/models/syllabus.rb @@ -1,7 +1,16 @@ class Syllabus < ActiveRecord::Base + include Redmine::SafeAttributes + include ApplicationHelper acts_as_taggable + acts_as_attachable + has_many_kindeditor_assets :assets, :dependent => :destroy belongs_to :user has_many :courses attr_accessible :description, :title, :eng_name, :type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course + safe_attributes 'title', 'description', 'eng_name', 'type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course' + + def delete_kindeditor_assets + delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS + end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index b7b5e73ac..68d062b65 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -260,6 +260,7 @@ class CoursesService course.send(:safe_attributes=, params[:course], current_user) #course.safe_attributes = params[:course] #course.password = params[:course][:password] + course.syllabus_id = params[:syllabus_id].to_i course.time = params[:time] course.term = params[:term] course.end_time = params[:end_time] diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index dbe03d67f..3fa0ee9fc 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/app/views/syllabuses/edit.html.erb b/app/views/syllabuses/edit.html.erb index f4c0f75e4..395fa1c5b 100644 --- a/app/views/syllabuses/edit.html.erb +++ b/app/views/syllabuses/edit.html.erb @@ -7,42 +7,6 @@

      课程信息

      - <%= labelled_form_for @syllabus, :url =>syllabus_path(@syllabus), :html => {:nhname=>'form',:multipart => true, :id => 'syllabus-form'} do |f| %>
      @@ -64,19 +28,20 @@

      + +
      +
      + <%= render :partial => 'attachments/form_course', :locals => {:container => @syllabus, :isReply => false} %> +
      +
      + +
      + 发送 + + 取消 +
      +
      <% end %> -
      -
      - <%= render :partial => 'attachments/form_course', :locals => {:container => @syllabus, :isReply => false} %> -
      -
      - 发送 - - 取消 -
      -
      - -
      \ No newline at end of file diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 57030c5d0..243f24115 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -1,42 +1,89 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> +

      课程信息

      -
      - <% if @syllabus.description.nil?%> +<% if @syllabus.des_status == 1 && @syllabus.courses.empty? %> +
      <% if User.current == @syllabus.user %> -

      您建立的课程尚未填写课程大纲,请完善您的<%=link_to '课程大纲', edit_syllabus_path(@syllabus) %>!

      +

      您建立的课程还未创建班级,请 + <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>。 +

      + <% elsif User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> +

      本课程下还未创建班级,请 + <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>。 +

      + <% else %> +

      本课程下还未创建班级,敬请期待。 +

      + <% end %> +
      +<% end %> +
      + <% if @syllabus.des_status == 0%> + <% if User.current == @syllabus.user %> +

      您建立的课程尚未填写课程大纲,请完善您的<%=link_to '课程大纲', edit_syllabus_path(@syllabus), :class => 'syllabusbox_a_blue' %>!

      <% else %>

      <%=@syllabus.user.show_name %>老师尚未完成课程大纲的编写,敬请期待。

      <% end %> <% else %>
      - <%=@syllabus.description %> + <%=@syllabus.description.html_safe %>
      <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @syllabus} %>
      -
      -
        -
      • -
          -
        • <%=link_to '编辑', edit_syllabus_path(@syllabus),:class=>'postOptionLink' %>
        • -
        • 删除
        • + <% if User.current.logged? && User.current == @syllabus.user%> +
          +
            +
          • +
              +
            • <%=link_to '编辑', edit_syllabus_path(@syllabus), :class => 'postOptionLink'%>
            • + <% if @syllabus.courses.empty? %> +
            • <%=link_to '删除', syllabus_path(@syllabus), :class => 'postOptionLink', :method => 'delete', :data => {:confirm => l(:text_are_you_sure)}%>
            • + <% end %> +
            +
          - -
        -
      -
      +
      +
      + <% end %> <% end %> -
      - -
      -
      用户头像
      -
      - - 发送
      + <% count=@syllabus.journals_for_messages.count %> +
      + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => @syllabus, :user_activity_id => @syllabus.id} %> + + <% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %> + <% if count > 0 %> +
      + <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> +
      + <% end %> +
      +
      <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
      +
      + <% if User.current.logged? %> +
      + <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_syllabus_message', :id => @syllabus.id},:method => "post") do |f|%> +
      + + +
      +

      + <% end%> +
      + <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
      +
      diff --git a/app/views/syllabuses/syllabus_courselist.html.erb b/app/views/syllabuses/syllabus_courselist.html.erb new file mode 100644 index 000000000..0b0713738 --- /dev/null +++ b/app/views/syllabuses/syllabus_courselist.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'syllabus_course_list'%> \ No newline at end of file diff --git a/app/views/syllabuses/syllabus_courselist.js.erb b/app/views/syllabuses/syllabus_courselist.js.erb new file mode 100644 index 000000000..5433ea2c1 --- /dev/null +++ b/app/views/syllabuses/syllabus_courselist.js.erb @@ -0,0 +1 @@ +$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'syllabus_course_list') %>'); \ No newline at end of file diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index efd3770aa..d4af9783e 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -74,7 +74,7 @@ <% end %>
      -
      <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
      +
      <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
      <% if User.current.logged? %>
      diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb new file mode 100644 index 000000000..4613e9e18 --- /dev/null +++ b/app/views/users/_user_syllabus_list.html.erb @@ -0,0 +1,75 @@ +
      +

      课程列表

      +
      + 排序: + <%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %> + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %> + <% end %> +
      +
      + +
      + <% if @syllabus.any? %> + <% @syllabus.each do |syllabus|%> +
      +
      + +

      <%=syllabus.title %>

      +
      + <%=link_to '管理课程', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr' %> +

      更新时间:2016-05-05创建老师:豆蔻

      +
      +
      + + <% end %> +
      +
        + <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> +
      +
      +
      + <% else %> +

      <%= l(:label_no_data) %>

      + <% end %> +
      +
      + + \ No newline at end of file diff --git a/app/views/users/user_courselist.html.erb b/app/views/users/user_courselist.html.erb index de0f647e2..148cc1703 100644 --- a/app/views/users/user_courselist.html.erb +++ b/app/views/users/user_courselist.html.erb @@ -1 +1 @@ -<%= render :partial => 'users/user_course_list'%> +<%= render :partial => 'users/user_syllabus_list'%> diff --git a/app/views/users/user_courselist.js.erb b/app/views/users/user_courselist.js.erb index 98c92be02..f6a69c288 100644 --- a/app/views/users/user_courselist.js.erb +++ b/app/views/users/user_courselist.js.erb @@ -1 +1 @@ -$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_course_list') %>'); \ No newline at end of file +$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_syllabus_list') %>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 7e2998262..673bb2c69 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1075,7 +1075,7 @@ RedmineApp::Application.routes.draw do #课程大纲路由设置 resources :syllabuses do member do - + match 'syllabus_courselist', :to => 'syllabuses#syllabus_courselist', :via => :get, :as => 'syllabus_courselist' end collection do @@ -1201,6 +1201,7 @@ RedmineApp::Application.routes.draw do match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" + post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message" post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message" post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework" diff --git a/db/migrate/20160629084146_add_visits_to_syllabus.rb b/db/migrate/20160629084146_add_visits_to_syllabus.rb new file mode 100644 index 000000000..7dc997e00 --- /dev/null +++ b/db/migrate/20160629084146_add_visits_to_syllabus.rb @@ -0,0 +1,5 @@ +class AddVisitsToSyllabus < ActiveRecord::Migration + def change + add_column :syllabuses, :visits, :integer, :default => 0 + end +end diff --git a/db/migrate/20160629094716_add_des_status_to_syllabus.rb b/db/migrate/20160629094716_add_des_status_to_syllabus.rb new file mode 100644 index 000000000..aa91bdd3c --- /dev/null +++ b/db/migrate/20160629094716_add_des_status_to_syllabus.rb @@ -0,0 +1,5 @@ +class AddDesStatusToSyllabus < ActiveRecord::Migration + def change + add_column :syllabuses, :des_status, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 5147a5c73..2502a941b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160627074232) do +ActiveRecord::Schema.define(:version => 20160629094716) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1865,8 +1865,8 @@ ActiveRecord::Schema.define(:version => 20160627074232) do t.string "title" t.text "description" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "eng_name" t.integer "type" t.integer "credit" @@ -1875,6 +1875,8 @@ ActiveRecord::Schema.define(:version => 20160627074232) do t.integer "practice_hours" t.string "applicable_major" t.string "pre_course" + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 end add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" diff --git a/public/images/syllabus/icons_syllabus.png b/public/images/syllabus/icons_syllabus.png new file mode 100644 index 0000000000000000000000000000000000000000..7f6c4987cc280922e84f6cc32ed3750b0af87e52 GIT binary patch literal 21845 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 FzW^EbD|7$= literal 0 HcmV?d00001 diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index cbdd5808f..d73bbc8bf 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -79,7 +79,7 @@ input.syllabus_input_min{ height:34px; } a.syllabusbox_a_blue{ - color:#3b94d6; + color:#3b94d6 !important; } .syllabus_leftinfo p{ line-height:25px; @@ -110,7 +110,7 @@ a.syllabusbox_a_blue{ .syllabus_box{ width:750px; border:1px solid #e7e7e7; background-color:#fff;} .syllabus_courses_list{ padding:15px; border-bottom:1px solid #e7e7e7; cursor:pointer;} .syllabus_courses_list:hover{ background:#f6fafd;} -.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +a.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .sy_p_grey{ margin-left:25px; color:#888; margin-top:5px; font-size:12px;} .syllabus_class_box{ padding-left:30px; background:#f6f6f6;} .syllabus_class_list{ padding:12px 0 12px 15px; height:44px;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7; position:relative;} @@ -127,9 +127,9 @@ a.syllabusbox_a_blue{ .listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } .bloglistbox{ min-height:690px;} .list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} -.category{ } +.category2{ } .list_title{padding:10px 0; border-bottom:1px solid #ddd;} -.category a,.category span{ float:left; margin-right:5px;} +.category2 a,.category2 span{ float:left; margin-right:5px;} .grayTxt{ color:#9093a6;} .sortTxt{ color:#000;} .sortTxt:hover{ color:#28be6c;} From ac4218bfb0cea2642f7b18e9a0b9dae3e7f83d72 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 30 Jun 2016 15:36:46 +0800 Subject: [PATCH 30/67] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 11 +-- app/helpers/courses_helper.rb | 9 ++ app/views/layouts/base_courses.html.erb | 7 +- app/views/users/_user_syllabus_list.html.erb | 88 ++++++++++++++------ public/javascripts/application.js | 19 +++++ public/stylesheets/syllabus.css | 2 +- 6 files changed, 99 insertions(+), 37 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 43d12cadf..68e7f5590 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3190,8 +3190,8 @@ class UsersController < ApplicationController # @courses = @user.courses.visible.where("is_delete =?", 0).order("#{sort_name} #{sort_type}") #@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}") - courses = @user.courses.visible.where("is_delete =?", 0) - syllabus_ids = courses.empty? ? '(-1)' : "(" + courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" + @courses = @user.courses.visible.where("is_delete =?", 0) + syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" @syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}") #根据 作业+资源数排序 @@ -3204,11 +3204,12 @@ class UsersController < ApplicationController # end # end @syllabus.each do |syllabus| - syllabus[:infocount] = 0 - courses = courses.select("syllabus_id = #{syllabus.id}") + count = 0 + courses = @courses.select("syllabus_id = #{syllabus.id}") courses.each do |c| - syllabus[:infocount] += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) + count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) end + syllabus[:infocount] = count end @c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]}) @syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index fd3be1369..dd3abe3a8 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -789,6 +789,15 @@ module CoursesHelper result end + def visable_course_homework course + if User.current.admin? || User.current.allowed_to?(:as_teacher,course) + homework_num = course.homework_commons.count + else + homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count + end + homework_num + end + def zh_course_role role if role == "TeachingAsistant" result = l(:label_TA) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 4b618bef1..8f4f443c0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,11 +1,8 @@ <%# course_model %> <% course_file_num = visable_attachemnts_incourse(@course).count%> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %> - <% homework_num = @course.homework_commons.count %> -<% else %> - <% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %> -<% end %> +<% homework_num = visable_course_homework @course %> + diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index 4613e9e18..dbf7e301a 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -19,17 +19,53 @@
      <% if @syllabus.any? %> - <% @syllabus.each do |syllabus|%> -
      -
      - + <% @syllabus.each_with_index do |syllabus, index|%> + <% courses = @courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS time").order("time desc") %> +
      +
      +

      <%=syllabus.title %>

      - <%=link_to '管理课程', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr' %> -

      更新时间:2016-05-05创建老师:豆蔻

      + <%=link_to '', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr', :title => '管理课程' %> +

      更新时间:<%=format_date syllabus.updated_at %> + 创建老师:<%=syllabus.user.show_name %> + 班级:<%=courses.count %> +

      + <% end %>
        @@ -50,26 +86,26 @@ var rightHeight = $(".homepageRight").height(); if (rightHeight < leftHeight) { var diffHeight = leftHeight - rightHeight; - var tmpHeight = $(".listbox").height() + diffHeight; - $(".listbox").css("height", tmpHeight); + var tmpHeight = $(".syllabus_box").height() + diffHeight; + $(".syllabus_box").css("height", tmpHeight); } - }); - $(".sy_courses_open").toggle(function(){ - //$(this).hide(); - $(this).parent().next().hide(); - $(this).addClass("sy_courses_close").removeClass("sy_courses_open"); - //$(this).parent().next().show(); - },function(){ - $(this).parent().next().show(); - $(this).addClass("sy_courses_open").removeClass("sy_courses_close"); - }); - $(".sy_courses_close").toggle(function(){ - //$(this).hide(); - $(this).parent().next().show(); - $(this).addClass("sy_courses_open").removeClass("sy_courses_close"); - //$(this).parent().next().show(); - },function(){ - $(this).parent().next().hide(); - $(this).addClass("sy_courses_close").removeClass("sy_courses_open"); + $(".sy_courses_open").toggle(function(){ + //$(this).hide(); + $(this).parent().next().hide(); + $(this).children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); + //$(this).parent().next().show(); + },function(){ + $(this).parent().next().show(); + $(this).children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); + }); + $(".sy_courses_close").toggle(function(){ + //$(this).hide(); + $(this).parent().next().show(); + $(this).children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); + //$(this).parent().next().show(); + },function(){ + $(this).parent().next().hide(); + $(this).children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); + }); }); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index a04df39ac..142b0be42 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1556,3 +1556,22 @@ function edit_file_description(url,id){ ); } +//展开课程大纲列表中的班级 +function expand_course_list(id, target, btnid, count) { + var target = $(target); + var btn = $(btnid); + if(btn.data('init')=='0'){ + btn.data('init',1); + btn.html('点击收起'); + target.show(); + }else{ + btn.data('init',0); + btn.html('共'+count+ '个课程,点击全部展开'); + target.hide(); + target.eq(0).show(); + target.eq(1).show(); + target.eq(2).show(); + btn.parent().show(); + } +} + diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index d73bbc8bf..83f6cefbc 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -110,7 +110,7 @@ a.syllabusbox_a_blue{ .syllabus_box{ width:750px; border:1px solid #e7e7e7; background-color:#fff;} .syllabus_courses_list{ padding:15px; border-bottom:1px solid #e7e7e7; cursor:pointer;} .syllabus_courses_list:hover{ background:#f6fafd;} -a.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .sy_p_grey{ margin-left:25px; color:#888; margin-top:5px; font-size:12px;} .syllabus_class_box{ padding-left:30px; background:#f6f6f6;} .syllabus_class_list{ padding:12px 0 12px 15px; height:44px;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7; position:relative;} From 397c4cc2a5944625f453b57217537eaf0b5dd08e Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 30 Jun 2016 16:08:36 +0800 Subject: [PATCH 31/67] =?UTF-8?q?1.=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=82=AE=E4=BB=B6=E4=BF=AE=E6=94=B92.?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99=E4=BF=AE=E6=94=B9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B93.=E9=97=AE=E9=A2=98=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=E5=A4=84=E5=A2=9E=E5=8A=A0=E7=9B=B4=E6=8E=A5=E5=8A=A0?= =?UTF-8?q?=E5=85=A5QQ=E7=BE=A4=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 3 +- app/controllers/my_controller.rb | 6 +- app/controllers/school_controller.rb | 51 +++ app/models/apply_add_schools.rb | 3 + app/views/layouts/_new_feedback.html.erb | 6 +- app/views/mailer/register.html.erb | 4 + app/views/my/_apply_add_school.html.erb | 337 ++++++++++++++++++ app/views/my/account.html.erb | 106 +++++- config/routes.rb | 3 +- ...160629030320_add_school_type_to_schools.rb | 5 + ...20160629081520_create_apply_add_schools.rb | 15 + db/schema.rb | 53 +-- public/images/icons_ziliao.png | Bin 0 -> 20180 bytes public/stylesheets/new_user.css | 97 ++++- public/stylesheets/users.css | 2 +- spec/factories/apply_add_schools.rb | 12 + spec/models/apply_add_schools_spec.rb | 5 + 17 files changed, 660 insertions(+), 48 deletions(-) create mode 100644 app/models/apply_add_schools.rb create mode 100644 app/views/my/_apply_add_school.html.erb create mode 100644 db/migrate/20160629030320_add_school_type_to_schools.rb create mode 100644 db/migrate/20160629081520_create_apply_add_schools.rb create mode 100644 public/images/icons_ziliao.png create mode 100644 spec/factories/apply_add_schools.rb create mode 100644 spec/models/apply_add_schools_spec.rb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 8bf40d472..62b076754 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -243,7 +243,8 @@ class AccountController < ApplicationController user = User.find(params[:user]) if params[:user] token = Token.new(:user => user, :action => "register") if token.save - Mailer.run.register(token) + # Mailer.run.register(token) + Mailer.register(token).deliver else yield if block_given? status = 0 diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 0883b3799..32c605516 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -127,12 +127,14 @@ class MyController < ApplicationController end @user.safe_attributes = params[:user] + @user.lastname = params[:lastname] + @user.firstname = "" @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') #@user.login = params[:login] unless @user.user_extensions.nil? if @user.user_extensions.identity == 2 - @user.firstname = params[:enterprise_name] + # @user.firstname = params[:enterprise_name] end end @@ -144,7 +146,7 @@ class MyController < ApplicationController # end @se.school_id = params[:occupation] - @se.gender = params[:gender] + @se.gender = params[:sex] @se.location = params[:province] if params[:province] @se.location_city = params[:city] if params[:city] @se.identity = params[:identity].to_i if params[:identity] diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index e0aff6254..44f4378fe 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -150,4 +150,55 @@ class SchoolController < ApplicationController format.js end end + + #申请高校(单位) name:名称 province:省 city:市 address:地址 remarks:备注 + def apply_add_school + + data = {result:0,name:params[:name],school_id:0} + #0 成功 1参数错误 2名称已存在 + data[:result] = 0 + + #检验参数 + if params[:name] == "" || params[:province] == "" || params[:city] == "" || params[:address] == "" + data[:result] = 1 + else + school_id = School.find_by_sql("select id from schools where name='#{params[:name]}'").first + if school_id + data[:result] = 2 + else + school = School.new + school.name = params[:name].strip + school.pinyin = Pinyin.t(params[:name].strip, splitter: '') + school.save + + #status 0未处理 1通过 2拒绝 + applyschool = ApplyAddSchools.new + applyschool.school_id = school.id + applyschool.name = school.name + applyschool.province = params[:province] + applyschool.city = params[:city] + applyschool.address = params[:address] + applyschool.remarks = params[:remarks] + applyschool.save + + data[:school_id] = school.id + end + end + render :json =>data + end + + def search_repeat_schoolname + status = 0 + name = params[:name] + + if name + school_id = School.find_by_sql("select id from schools where name='#{name}'").first + + if school_id + status = 1 + end + end + + render :json =>status + end end diff --git a/app/models/apply_add_schools.rb b/app/models/apply_add_schools.rb new file mode 100644 index 000000000..2082c0012 --- /dev/null +++ b/app/models/apply_add_schools.rb @@ -0,0 +1,3 @@ +class ApplyAddSchools < ActiveRecord::Base + attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status +end diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index ffec82bce..e2e935f57 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -16,7 +16,7 @@ <%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> - + <%= l(:label_submit)%> <% end %> @@ -25,7 +25,9 @@ <%#= l(:label_technical_support) %> -

        请加入师姐师兄答疑群

        QQ群号:173184401

        + + + Trustie师姐师兄答疑群
      diff --git a/app/views/mailer/register.html.erb b/app/views/mailer/register.html.erb index 282deca90..5b4e8262b 100644 --- a/app/views/mailer/register.html.erb +++ b/app/views/mailer/register.html.erb @@ -1,2 +1,6 @@

      <%= l(:mail_body_register) %>
      <%= link_to h(@url), @url %>

      +

      如果点击链接无效请复制该链接到浏览器中打开

      +
      +

      感谢您的使用!

      +

      Trustie团队

      diff --git a/app/views/my/_apply_add_school.html.erb b/app/views/my/_apply_add_school.html.erb new file mode 100644 index 000000000..1449fa1f1 --- /dev/null +++ b/app/views/my/_apply_add_school.html.erb @@ -0,0 +1,337 @@ +

      添加新的高校(单位)

      +
      +
        +
      • + + + +
      • +
      • + + 例如:国防科学技术大学 + 国防科大计算机1班 +
      • +
      • + + + + +
      • +
      • + + +
      • +
      • +
        +
      • +
      + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index f28ad1ca2..589541c39 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -20,8 +20,8 @@
    • *  职业 : 
    • *  姓名 : 
    • 组织名 : *
    • -
    • 性别 : 
    • -
    • 单位名称 : 
    • +
    • *  性别 : 
    • +
    • *  单位名称 : 
    • 地区 : 
    • 邮件通知 : 
    • @@ -64,19 +64,51 @@ -
    • <%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> +
    • <%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> -
    • <%= text_field_tag :enterprise_name,@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
    • - - + <% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %> + + <% else %> + + <% end %> +
    • -
    • - -

      您输入的名称尚不存在,申请添加

      +
    • + <% if User.current.user_extensions.nil? %> + + +

      + + +

      + + <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> + + +

      + + +

      + + <% elsif User.current.user_extensions.school.nil? %> + + +

      + + +

      + + <% else %> + + +

      + + +

      + + <% end %>
    • @@ -412,6 +444,7 @@ $("*[nh_required='1']",$(this)).attr("required",true); $(this).show() }); + $("#identity_hint").hide(); } function init_identity_and_title(pField, identity, cField, title, language) { for (var i = 0; i < pField.options.length; i++) { @@ -516,6 +549,14 @@ $("input[name='occupation']").val(data); $("#search_school_result_list").hide(); $("#hint").hide(); + $("#errortip").hide(); + + } + + function apply_add_school(){ + var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>"; + pop_up_box(htmlvalue,580,20,48); + } function add_school(name){ $.ajax({ @@ -602,16 +643,19 @@ $("#search_school_result_list").show(); if($(e.target).val().trim() != '') { str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value; - $("#hint").html('找到了' + count + '个包含"' + str + '"的高校'); + $("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)'); $("#hint").show(); + $("#errortip").hide(); }else{ $("#hint").hide(); + $("#errortip").hide(); } }else{ $("#search_school_result_list").html(''); str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; - $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); + $("#hint").html('您输入的名称尚不存在,申请添加'); $("#hint").show(); + $("#errortip").show(); } } }); @@ -621,6 +665,7 @@ { $("#search_school_result_list").hide(); $("#hint").hide(); + $("#errortip").hide(); } }); $("input[name='province']").on('focus', function (e) { @@ -648,16 +693,19 @@ $("#search_school_result_list").show(); if($(e.target).val().trim() != '') { str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value; - $("#hint").html('找到了' + count + '个包含"' + str + '"的高校'); + $("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)'); $("#hint").show(); + $("#errortip").hide(); }else{ $("#hint").hide(); + $("#errortip").hide(); } }else{ $("#search_school_result_list").html(''); str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; - $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); + $("#hint").html('您输入的名称尚不存在,申请添加'); $("#hint").show(); + $("#errortip").show(); } } }); @@ -685,19 +733,41 @@ <% if( !@act.nil? && @act == 'password') %> $("#users_tb_2").click(); <% end %> - $('#my_account_form_link').click(function(e){ + + $('#my_account_form_link').on("click",(function(e){ + //$('#my_account_form_link').click(function(e){ if($("#userIdentity").val() == -1 ) { $("#identity_hint").html('请选择身份').show(); e.stopImmediatePropagation(); return; } if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 - $("#hint").html('学校必须是从下拉列表中选择的,不能手动修改').show(); + $("#hint").html('单位名称必须是从下拉列表中选择的,不能手动修改').show(); + e.stopImmediatePropagation(); + return; + } + + //姓名不能为空 + if( $("#lastname").val() == '' ){ + $("#lastname").focus(); + e.stopImmediatePropagation(); + return; + } + + if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写 + $("#hint").html('高校(单位)名称不能为空').show(); e.stopImmediatePropagation(); return; } + + if($("#no").is(":visible") == true && $("#no").val() == ""){ + $("#no").focus(); + e.stopImmediatePropagation(); + return; + } + $('#my_account_form_btn').click(); - }); + })); $('#my_password_form_link').click(function(){ $('#my_password_form_btn').click(); }); diff --git a/config/routes.rb b/config/routes.rb index 14ee3f0b8..d56f75ced 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -213,7 +213,8 @@ RedmineApp::Application.routes.draw do resources :school, :except => [:show] do collection do - + get 'apply_add_school' + get 'search_repeat_schoolname' end member do diff --git a/db/migrate/20160629030320_add_school_type_to_schools.rb b/db/migrate/20160629030320_add_school_type_to_schools.rb new file mode 100644 index 000000000..ad23ae555 --- /dev/null +++ b/db/migrate/20160629030320_add_school_type_to_schools.rb @@ -0,0 +1,5 @@ +class AddSchoolTypeToSchools < ActiveRecord::Migration + def change + add_column :schools, :school_type, :integer, :default => false + end +end diff --git a/db/migrate/20160629081520_create_apply_add_schools.rb b/db/migrate/20160629081520_create_apply_add_schools.rb new file mode 100644 index 000000000..3d47f55a1 --- /dev/null +++ b/db/migrate/20160629081520_create_apply_add_schools.rb @@ -0,0 +1,15 @@ +class CreateApplyAddSchools < ActiveRecord::Migration + def change + create_table :apply_add_schools do |t| + t.string :name + t.string :province + t.string :city + t.string :address + t.string :remarks + t.integer :school_id + t.integer :status, :default => false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 148a6e21b..615a9001e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160624032138) do +ActiveRecord::Schema.define(:version => 20160629081520) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -57,6 +57,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.integer "user_id", :null => false end + create_table "apply_add_schools", :force => true do |t| + t.string "name" + t.string "province" + t.string "city" + t.string "address" + t.string "remarks" + t.integer "school_id" + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "apply_homeworks", :force => true do |t| t.integer "status" t.integer "user_id" @@ -1125,23 +1137,6 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.integer "viewed_count", :default => 0 end - create_table "mess", :id => false, :force => true do |t| - t.string "课程名" - t.integer "课程ID", :default => 0, :null => false - t.string "教师姓", :default => "", :null => false - t.string "教师名", :limit => 30, :default => "", :null => false - t.string "主贴名", :default => "", :null => false - t.integer "主贴或回帖ID", :default => 0, :null => false - t.integer "回帖对应主贴ID" - t.integer "帖子点赞数" - t.integer "主贴回复数", :default => 0, :null => false - t.text "主贴或回帖内容" - t.datetime "发帖时间", :null => false - t.integer "发帖或回帖用户ID", :default => 0, :null => false - t.string "发帖或回帖用户姓", :default => "", :null => false - t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false - end - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1539,6 +1534,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "quality_analyses", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + end + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1637,10 +1644,11 @@ ActiveRecord::Schema.define(:version => 20160624032138) do 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.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "logo_link" t.string "pinyin" + t.integer "school_type", :default => 0 end create_table "secdomains", :force => true do |t| @@ -1765,6 +1773,7 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.integer "status", :default => 9 t.text "results" t.text "src" + t.integer "uwait_time", :default => 0 end create_table "student_works", :force => true do |t| @@ -1783,8 +1792,8 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false - t.integer "simi_id" - t.integer "simi_value" + t.integer "simi_id", :default => 0 + t.integer "simi_value", :default => 0 t.float "work_score" end diff --git a/public/images/icons_ziliao.png b/public/images/icons_ziliao.png new file mode 100644 index 0000000000000000000000000000000000000000..dc72e7361419bdefbc5a26b37d2cafee3e921e6c GIT binary patch literal 20180 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 'ApplyAddSchools' do + name "MyString" +province "MyString" +city "MyString" +address "MyString" +remarks "MyString" +school_id 1 +status 1 + end + +end diff --git a/spec/models/apply_add_schools_spec.rb b/spec/models/apply_add_schools_spec.rb new file mode 100644 index 000000000..de1b7c05a --- /dev/null +++ b/spec/models/apply_add_schools_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ApplyAddSchools, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 10f52f110f09ab439cc6894b531cf2da0a320e9c Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 30 Jun 2016 16:12:25 +0800 Subject: [PATCH 32/67] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=82=B9=E5=87=BB=E5=B1=95=E5=BC=80=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=EF=BC=8C=E9=85=8D=E7=BD=AE=E6=8C=89=E9=92=AE=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_syllabus_list.html.erb | 23 +- db/schema.rb | 4514 +++++++++--------- public/stylesheets/syllabus.css | 3 +- 3 files changed, 2271 insertions(+), 2269 deletions(-) diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index dbf7e301a..153e11592 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -26,7 +26,6 @@

      <%=syllabus.title %>

    • - <%=link_to '', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr', :title => '管理课程' %>

      更新时间:<%=format_date syllabus.updated_at %> 创建老师:<%=syllabus.user.show_name %> 班级:<%=courses.count %> @@ -66,6 +65,9 @@ <% end %>

    + + + <%=link_to '', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr', :title => '管理课程' %> <% end %>
      @@ -89,23 +91,22 @@ var tmpHeight = $(".syllabus_box").height() + diffHeight; $(".syllabus_box").css("height", tmpHeight); } - $(".sy_courses_open").toggle(function(){ - //$(this).hide(); - $(this).parent().next().hide(); - $(this).children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); + $(".syllabus_courses_list").toggle(function(){ + $(this).next().hide(); + $(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); //$(this).parent().next().show(); },function(){ - $(this).parent().next().show(); - $(this).children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); + $(this).next().show(); + $(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); }); $(".sy_courses_close").toggle(function(){ //$(this).hide(); - $(this).parent().next().show(); - $(this).children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); + $(this).next().show(); + $(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close"); //$(this).parent().next().show(); },function(){ - $(this).parent().next().hide(); - $(this).children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); + $(this).next().hide(); + $(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open"); }); }); \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index bf9d24b3e..9204e13e9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,2257 +1,2257 @@ -# 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 => 20160629094716) 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_homeworks", :force => true do |t| - t.integer "status" - t.integer "user_id" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "apply_homeworks", ["homework_common_id"], :name => "index_apply_homeworks_on_homework_common_id" - add_index "apply_homeworks", ["user_id"], :name => "index_apply_homeworks_on_user_id" - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "apply_resources", :force => true do |t| - t.integer "status" - t.integer "user_id" - t.integer "attachment_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id" - t.string "container_type" - t.text "content" - t.integer "apply_user_id" - end - - create_table "at_messages", :force => true do |t| - t.integer "user_id" - t.integer "at_message_id" - t.string "at_message_type" - t.boolean "viewed", :default => false - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sender_id" - end - - add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" - - create_table "attachment_histories", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.string "filename", :default => "" - t.string "disk_filename", :default => "" - t.integer "filesize", :default => 0 - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "" - t.integer "downloads", :default => 0 - t.integer "author_id" - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.integer "copy_from" - t.integer "quotes" - t.integer "version" - t.integer "attachment_id" - t.integer "is_publish", :default => 1 - t.date "publish_time" - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - t.integer "is_publish", :default => 1 - t.date "publish_time" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "homepage_id" - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - t.integer "org_subfield_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "code_tests", :force => true do |t| - t.integer "homework_id" - t.integer "wait_time", :default => 0 - t.integer "language" - t.integer "status" - t.integer "time_used", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "student_work_id", :default => 0 - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - 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 - - add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index" - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num", :default => 0 - t.integer "message_reply_num", :default => 0 - t.integer "news_reply_num", :default => 0 - t.integer "resource_num", :default => 0 - t.integer "journal_num", :default => 0 - t.integer "journal_reply_num", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score", :default => 0 - t.integer "homework_journal_num", :default => 0 - t.integer "news_num", :default => 0 - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_messages", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_message_id" - t.string "course_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "content" - t.integer "status" - t.integer "apply_user_id" - t.integer "apply_result" - end - - add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type" - add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at" - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 - t.integer "end_time" - t.string "end_term" - t.integer "is_excellent", :default => 0 - t.integer "excellent_option", :default => 0 - t.integer "is_copy", :default => 0 - t.integer "visits", :default => 0 - t.integer "syllabus_id" - t.string "invite_code" - t.string "qrcode" - end - - add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true - add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "documents", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "category_id", :default => 0, :null => false - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 - t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false - end - - create_table "editor_of_documents", :force => true do |t| - t.integer "editor_id" - t.integer "org_document_comment_id" - t.datetime "created_at" - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" - add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index" - - create_table "forge_messages", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_message_id" - t.string "forge_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "secret_key" - t.integer "status" - end - - add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" - add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "forwards", :force => true do |t| - t.integer "from_id" - t.string "from_type" - t.integer "to_id" - t.string "to_type" - t.datetime "created_at" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - t.integer "quotes", :default => 0 - t.integer "is_open", :default => 0 - t.datetime "simi_time" - end - - add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - t.integer "private", :default => 0 - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type" - add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at" - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type" - add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at" - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.integer "quotes" - t.integer "status", :default => 0 - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - t.integer "status", :default => 0 - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_messages", :force => true do |t| - t.integer "user_id" - t.integer "sender_id" - t.integer "organization_id" - t.string "message_type" - t.integer "message_id" - t.integer "viewed" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 0 - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "org_subfield_messages", :force => true do |t| - t.integer "org_subfield_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_subfields", :force => true do |t| - t.integer "organization_id" - t.integer "priority" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "field_type" - t.integer "hide", :default => 0 - t.integer "status", :default => 1 - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "allow_guest_download", :default => true - t.integer "visits", :default => 0 - t.integer "show_mode", :default => 0 - t.integer "allow_teacher", :default => 0 - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - t.integer "board_num", :default => 0 - t.integer "attach_num", :default => 0 - t.datetime "commit_time" - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - t.integer "forked_from_project_id" - t.integer "forked_count" - t.integer "commits_count", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "issues_count", :default => 0 - t.integer "attachments_count", :default => 0 - t.integer "boards_count", :default => 0 - t.integer "news_count", :default => 0 - t.integer "acts_count", :default => 0 - t.integer "journals_count", :default => 0 - t.integer "boards_reply_count", :default => 0 - t.integer "visits", :default => 0 - t.integer "hot", :default => 0 - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "quality_analyses", :force => true do |t| - t.integer "project_id" - t.string "author_login" - t.string "rep_identifier" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sonar_version", :default => 0 - t.string "path" - t.string "branch" - t.string "language" - end - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "rep_statics", :force => true do |t| - t.integer "project_id" - t.integer "commits_num" - t.string "uname" - t.string "email" - t.integer "add" - t.integer "del" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "changeset" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "secdomains", :force => true do |t| - t.integer "sub_type" - t.string "subname" - t.integer "pid", :default => 0 - t.string "desc" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "shield_activities", :force => true do |t| - t.string "container_type" - t.integer "container_id" - t.string "shield_type" - t.integer "shield_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "shield_wechat_messages", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.integer "shield_id" - t.string "shield_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "ssos", :force => true do |t| - t.integer "user_id" - t.string "openid" - t.string "name" - t.string "password" - t.string "email" - t.integer "sex" - t.string "school" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id" - - create_table "student_work_projects", :force => true do |t| - t.integer "homework_common_id" - t.integer "student_work_id" - t.integer "project_id" - t.integer "user_id" - t.integer "is_leader" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" - add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" - add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" - add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - t.integer "simi_id" - t.integer "simi_value" - t.float "work_score" - end - - add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "sub_document_comments", :force => true do |t| - t.text "content" - t.text "title" - t.integer "sub_domain_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.integer "locked" - t.integer "sticky" - t.integer "org_subfield_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "sub_domains", :force => true do |t| - t.integer "org_subfield_id" - t.integer "priority", :default => 0 - t.string "name" - t.string "field_type" - t.integer "hide", :default => 0 - t.integer "status", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "subfield_subdomain_dirs", :force => true do |t| - t.integer "org_subfield_id" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "syllabuses", :force => true do |t| - t.string "title" - t.text "description" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "eng_name" - t.integer "type" - t.integer "credit" - t.integer "hours" - t.integer "theory_hours" - t.integer "practice_hours" - t.string "applicable_major" - t.string "pre_course" - t.integer "visits", :default => 0 - t.integer "des_status", :default => 0 - end - - add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_actions", :force => true do |t| - t.integer "user_id" - t.string "action_type" - t.integer "action_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index" - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id" - add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at" - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "user_wechats", :force => true do |t| - t.integer "subscribe" - t.string "openid" - t.string "nickname" - t.integer "sex" - t.string "language" - t.string "city" - t.string "province" - t.string "country" - t.string "headimgurl" - t.string "subscribe_time" - t.string "unionid" - t.string "remark" - t.integer "groupid" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - t.integer "gid" - t.integer "visits", :default => 0 - t.integer "excellent_teacher", :default => 0 - t.integer "excellent_student", :default => 0 - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wechat_logs", :force => true do |t| - t.string "openid", :null => false - t.text "request_raw" - t.text "response_raw" - t.text "session_raw" - t.datetime "created_at", :null => false - end - - 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 => 20160629094716) 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_homeworks", :force => true do |t| + t.integer "status" + t.integer "user_id" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "apply_homeworks", ["homework_common_id"], :name => "index_apply_homeworks_on_homework_common_id" + add_index "apply_homeworks", ["user_id"], :name => "index_apply_homeworks_on_user_id" + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "apply_resources", :force => true do |t| + t.integer "status" + t.integer "user_id" + t.integer "attachment_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id" + t.string "container_type" + t.text "content" + t.integer "apply_user_id" + end + + create_table "at_messages", :force => true do |t| + t.integer "user_id" + t.integer "at_message_id" + t.string "at_message_type" + t.boolean "viewed", :default => false + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sender_id" + end + + add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "attachment_id" + t.integer "is_publish", :default => 1 + t.date "publish_time" + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + t.integer "is_publish", :default => 1 + t.date "publish_time" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "homepage_id" + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + t.integer "org_subfield_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "code_tests", :force => true do |t| + t.integer "homework_id" + t.integer "wait_time", :default => 0 + t.integer "language" + t.integer "status" + t.integer "time_used", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "student_work_id", :default => 0 + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + 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 + + add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index" + + create_table "course_attachments", :force => true do |t| + t.string "filename" + t.string "disk_filename" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_contributor_scores", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.integer "message_num", :default => 0 + t.integer "message_reply_num", :default => 0 + t.integer "news_reply_num", :default => 0 + t.integer "resource_num", :default => 0 + t.integer "journal_num", :default => 0 + t.integer "journal_reply_num", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "total_score", :default => 0 + t.integer "homework_journal_num", :default => 0 + t.integer "news_num", :default => 0 + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "content" + t.integer "status" + t.integer "apply_user_id" + t.integer "apply_result" + end + + add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type" + add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at" + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 + t.integer "end_time" + t.string "end_term" + t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 + t.integer "visits", :default => 0 + t.integer "syllabus_id" + t.string "invite_code" + t.string "qrcode" + end + + add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true + add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "documents", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "category_id", :default => 0, :null => false + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 + t.string "File" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false + end + + create_table "editor_of_documents", :force => true do |t| + t.integer "editor_id" + t.integer "org_document_comment_id" + t.datetime "created_at" + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index" + + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" + end + + add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" + add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "forwards", :force => true do |t| + t.integer "from_id" + t.string "from_type" + t.integer "to_id" + t.string "to_type" + t.datetime "created_at" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + t.integer "quotes", :default => 0 + t.integer "is_open", :default => 0 + t.datetime "simi_time" + end + + add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + + create_table "journal_replies", :id => false, :force => true do |t| + t.integer "journal_id" + t.integer "user_id" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + t.integer "private", :default => 0 + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type" + add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at" + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type" + add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at" + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.integer "quotes" + t.integer "status", :default => 0 + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + t.integer "status", :default => 0 + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_messages", :force => true do |t| + t.integer "user_id" + t.integer "sender_id" + t.integer "organization_id" + t.string "message_type" + t.integer "message_id" + t.integer "viewed" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 0 + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "org_subfield_messages", :force => true do |t| + t.integer "org_subfield_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_subfields", :force => true do |t| + t.integer "organization_id" + t.integer "priority" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "field_type" + t.integer "hide", :default => 0 + t.integer "status", :default => 1 + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "allow_guest_download", :default => true + t.integer "visits", :default => 0 + t.integer "show_mode", :default => 0 + t.integer "allow_teacher", :default => 0 + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + t.integer "board_num", :default => 0 + t.integer "attach_num", :default => 0 + t.datetime "commit_time" + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + t.integer "forked_from_project_id" + t.integer "forked_count" + t.integer "commits_count", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "issues_count", :default => 0 + t.integer "attachments_count", :default => 0 + t.integer "boards_count", :default => 0 + t.integer "news_count", :default => 0 + t.integer "acts_count", :default => 0 + t.integer "journals_count", :default => 0 + t.integer "boards_reply_count", :default => 0 + t.integer "visits", :default => 0 + t.integer "hot", :default => 0 + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "quality_analyses", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + end + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "rep_statics", :force => true do |t| + t.integer "project_id" + t.integer "commits_num" + t.string "uname" + t.string "email" + t.integer "add" + t.integer "del" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "changeset" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "secdomains", :force => true do |t| + t.integer "sub_type" + t.string "subname" + t.integer "pid", :default => 0 + t.string "desc" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "is_teacher_score", :default => 0 + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "shield_activities", :force => true do |t| + t.string "container_type" + t.integer "container_id" + t.string "shield_type" + t.integer "shield_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "shield_wechat_messages", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.integer "shield_id" + t.string "shield_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "ssos", :force => true do |t| + t.integer "user_id" + t.string "openid" + t.string "name" + t.string "password" + t.string "email" + t.integer "sex" + t.string "school" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "ssos", ["user_id"], :name => "index_ssos_on_user_id" + + create_table "student_work_projects", :force => true do |t| + t.integer "homework_common_id" + t.integer "student_work_id" + t.integer "project_id" + t.integer "user_id" + t.integer "is_leader" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" + add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" + add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" + add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + t.integer "simi_id" + t.integer "simi_value" + t.float "work_score" + end + + add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "sub_document_comments", :force => true do |t| + t.text "content" + t.text "title" + t.integer "sub_domain_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.integer "locked" + t.integer "sticky" + t.integer "org_subfield_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sub_domains", :force => true do |t| + t.integer "org_subfield_id" + t.integer "priority", :default => 0 + t.string "name" + t.string "field_type" + t.integer "hide", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "subfield_subdomain_dirs", :force => true do |t| + t.integer "org_subfield_id" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "syllabuses", :force => true do |t| + t.string "title" + t.text "description" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "eng_name" + t.integer "type" + t.integer "credit" + t.integer "hours" + t.integer "theory_hours" + t.integer "practice_hours" + t.string "applicable_major" + t.string "pre_course" + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 + end + + add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_actions", :force => true do |t| + t.integer "user_id" + t.string "action_type" + t.integer "action_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index" + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id" + add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at" + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "user_wechats", :force => true do |t| + t.integer "subscribe" + t.string "openid" + t.string "nickname" + t.integer "sex" + t.string "language" + t.string "city" + t.string "province" + t.string "country" + t.string "headimgurl" + t.string "subscribe_time" + t.string "unionid" + t.string "remark" + t.integer "groupid" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + t.string "identity_url" + t.string "mail_notification", :default => "", :null => false + t.string "salt", :limit => 64 + t.integer "gid" + t.integer "visits", :default => 0 + t.integer "excellent_teacher", :default => 0 + t.integer "excellent_student", :default => 0 + end + + add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wechat_logs", :force => true do |t| + t.string "openid", :null => false + t.text "request_raw" + t.text "response_raw" + t.text "session_raw" + t.datetime "created_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 83f6cefbc..88c8cebbf 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -101,7 +101,8 @@ a.syllabusbox_a_blue{ .icon_course{ background: url(../images/syllabus/icons_syllabus.png) 0 -35px no-repeat; width:18px; height:15px; display:block;} .icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -53px no-repeat; width:20px; height:23px; display:block; cursor:pointer; } .icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -53px no-repeat; width:20px; height:23px; display:block; } -.icons_sy_setting{background: url(../images/syllabus/icons_syllabus.png) -51px -33px no-repeat; width:20px; height:20px; display:block; } +.syllabus_courses_box {position:relative;} +.icons_sy_setting{background: url(../images/syllabus/icons_syllabus.png) -51px -33px no-repeat; width:20px; height:20px; display:block; position:absolute; right:10px; top:10px; } .icons_sy_setting:hover{background: url(../images/syllabus/icons_syllabus.png) -25px -33px no-repeat; } .icons_sy_cir{background: url(../images/syllabus/icons_syllabus.png) 0px -82px no-repeat; width:15px; height:15px; display:block; position:absolute; left:-8px; top:25px;} .icons_sy_arrow{background: url(../images/syllabus/icons_syllabus.png) -31px -81px no-repeat; width:20px; height:20px; display:block; } From 5cc40408eea01dd53701b67ea9f80b2a4c48c811 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 30 Jun 2016 16:30:02 +0800 Subject: [PATCH 33/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9KE=E5=8D=95=E5=80=8D?= =?UTF-8?q?=E8=A1=8C=E8=B7=9D=E6=98=BE=E7=A4=BA=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/my/zh.yml | 2 +- config/locales/zh.yml | 2 +- public/stylesheets/courses.css | 3 ++- public/stylesheets/new_user.css | 1 + public/stylesheets/project.css | 1 + public/stylesheets/public.css | 1 + 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/locales/my/zh.yml b/config/locales/my/zh.yml index 25a949df4..39c7c3167 100644 --- a/config/locales/my/zh.yml +++ b/config/locales/my/zh.yml @@ -28,7 +28,7 @@ zh: label_account_identity_choose: --请选择身份-- label_account_identity_teacher: 教师 label_account_identity_student: 学生 - label_account_identity_developer: 开发者 + label_account_identity_developer: 从业者 label_account_identity_enterprise: 组织 label_account_identity_studentID: 请输入学号 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3dbd2e8ef..c80a39891 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1665,7 +1665,7 @@ zh: #add by men label_account_identity_teacher: 教师 label_account_identity_student: 学生 - label_account_identity_developer: 开发者 + label_account_identity_developer: 从业者 label_account_identity_enterprise: 组织 label_teaching_course: 我执教的课程 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index d0a5e7ab3..a94e61d1d 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -152,6 +152,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #136ec2;} +.homepagePostIntro p{line-height: 1;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} .homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} @@ -1426,4 +1427,4 @@ a.pages-big{ width:50px;} .H60 {height:60px !important;} .W420 {width:420px;} .W300 {width:300px !important;} -.W600{ width:600px;} +.W600{ width:600px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index b931dff6b..a65edc490 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -683,6 +683,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #136ec2;} +.homepagePostIntro p{line-height: 1;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} .borderBottomNone {border-bottom:none !important;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index bde560613..354c0f1ac 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -969,6 +969,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} color: #484848; overflow: hidden; } +.homepagePostIntro p{line-height: 1;} .homepagePostReply { width: 710px; margin: 10px auto 0px; diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 500923519..bf7d288a7 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -632,6 +632,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #136ec2;} +.homepagePostIntro p{line-height: 1;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} .homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} From 24f1375a4e2bc0d1a08d7a360a8048861654dbbf Mon Sep 17 00:00:00 2001 From: txz Date: Thu, 30 Jun 2016 17:36:33 +0800 Subject: [PATCH 34/67] modified job --- app/views/quality_analysis/_edit.html.erb | 23 +++++++++++++++++++++++ app/views/quality_analysis/edit.js.erb | 0 2 files changed, 23 insertions(+) create mode 100644 app/views/quality_analysis/_edit.html.erb create mode 100644 app/views/quality_analysis/edit.js.erb diff --git a/app/views/quality_analysis/_edit.html.erb b/app/views/quality_analysis/_edit.html.erb new file mode 100644 index 000000000..d5cd49d0c --- /dev/null +++ b/app/views/quality_analysis/_edit.html.erb @@ -0,0 +1,23 @@ +
      代码质量分析
      +
      + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :remote => true, :id => 'quality_analyses_form') do %> +
      +
      + +
      +
      +
      + <%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch', :class => "analysis-option-box" %> +
      +
      +
      +
      + <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %> +
      +
      + + +
      +
      + <% end %> +
      diff --git a/app/views/quality_analysis/edit.js.erb b/app/views/quality_analysis/edit.js.erb new file mode 100644 index 000000000..e69de29bb From a8bd91754d348ac6e5c2770fe3574d85e03482a5 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 1 Jul 2016 09:27:46 +0800 Subject: [PATCH 35/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=9A=E5=AE=A2?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=87=8C=E9=9D=A2=E5=86=85=E5=AE=B9=E5=89=8D?= =?UTF-8?q?=E9=9D=A2=E5=A4=9A=E7=A9=BA=E6=A0=BC=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_comments/show.html.erb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 7d8aaed86..b1cd86484 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -91,9 +91,10 @@
    <%= format_time( @article.created_on)%>
    -
    - <%= @article.content.html_safe%> -
    + + + + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
    <%#= link_to_attachments_course @topic, :author => false %> @@ -192,12 +193,12 @@
    From db1ad932c61409bdc2327bbb4a60c86cec457784 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 1 Jul 2016 09:31:05 +0800 Subject: [PATCH 36/67] Function : update jenkins job --- .../quality_analysis_controller.rb | 62 ++- app/views/quality_analysis/_edit.html.erb | 8 +- .../quality_analysis/_result_list.html.erb | 19 +- app/views/quality_analysis/edit.js.erb | 8 + config/routes.rb | 3 +- db/schema.rb | 402 +----------------- 6 files changed, 86 insertions(+), 416 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 15fdcef61..1f5695605 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -1,7 +1,8 @@ class QualityAnalysisController < ApplicationController before_filter :find_project_by_project_id#, :except => [:getattachtype] + before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job] before_filter :authorize - before_filter :connect_jenkins, :only => [:create] + before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job] layout "base_projects" include ApplicationHelper require 'jenkins_api_client' @@ -54,7 +55,7 @@ class QualityAnalysisController < ApplicationController # return '201' if build successed code = @client.job.build("#{job_name}") logger.error("build result ==> #{code}") - d = @client.delete("#{job_name}") if jenkins_job == '200' && code != '201' + d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201' logger.error("delete result ==> #{code}") if qa.blank? && code == '201' QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, @@ -86,11 +87,54 @@ class QualityAnalysisController < ApplicationController end def edit - @quality_analysis = QualityAnalysis.where(:id => params[:id]) + @g = Gitlab.client + gitlab_branches = @g.branches(@project.gpid) + @branch_names = gitlab_branches.map{|b| b.name} + @gitlab_default_branch = @g.project(@project.gpid).default_branch end - def update - @quality_analysis = QualityAnalysis.where(:id => params[:id]) + def update_jenkins_job + begin + rep_id = Repository.where(:project_id => @project.id).first.try(:id) + logger.error("#############################===>666") + sonar_name = @quality_analysis.sonar_name + job_name = "#{@quality_analysis.author_login}-#{rep_id}" + version = @quality_analysis.sonar_version + path = params[:path].blank? ? "./" : params[:path] + language = swith_language_type(params[:language]) + branch = params[:branch] + identifier = @quality_analysis.rep_identifier + properties = "sonar.projectKey=#{sonar_name} + sonar.projectName=#{sonar_name} + sonar.projectVersion=#{version} + sonar.sources=#{path} + sonar.language=#{language.downcase} + sonar.sourceEncoding=utf-8" + git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" + + # modify config.yml + @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) + @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url + @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" + @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties + + # return '200' if successed + jenkins_job = @client.job.update("#{job_name}", @doc.to_xml) + logger.error("Failed to update job: ==> #{jenkins_job}") unless jenkins_job == '200' + if jenkins_job == '200' + logger.info("quality_ananlysis will be updated: ==> #{jenkins_job}") + @quality_analysis.path = path + @quality_analysis.language = language + @quality_analysis.branch = branch + @quality_analysis.save + end + rescue Exception => e + logger.error("Update jenkins job: #{e}") + end + respond_to do |format| + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id)} + format.js + end end # resource_id: login + @repository.id @@ -123,6 +167,14 @@ class QualityAnalysisController < ApplicationController render_404 end + def find_quality_analysis + begin + @quality_analysis = QualityAnalysis.find(params[:id]) + rescue + render_404 + end + end + # Authorize the user for the requested action def authorize(ctrl = params[:controller], action = params[:action], global = false) unless @project.archived? && @project.gpid.nil? diff --git a/app/views/quality_analysis/_edit.html.erb b/app/views/quality_analysis/_edit.html.erb index d5cd49d0c..f508ee5de 100644 --- a/app/views/quality_analysis/_edit.html.erb +++ b/app/views/quality_analysis/_edit.html.erb @@ -1,21 +1,21 @@
    代码质量分析
    - <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :remote => true, :id => 'quality_analyses_form') do %> + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'update_jenkins_job', :project_id => @project.id), :id => 'quality_analyses_edit_form') do %>
    - <%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch', :class => "analysis-option-box" %> + <%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @quality_analysis.branch), :value => 77, :id => 'branch', :class => "analysis-option-box" %>
    - <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %> + <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"], "#{@quality_analysis.language}"), :id => 'branch', :class => "analysis-option-box" %>
    - +
    diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index b4a40de0d..c47d51f1f 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -3,22 +3,21 @@
    • 名称
    • -
    • 版本
    • -
    • 分支
    • -
    • 语言
    • -
    • 路径
    • -
    • bianji
    • +
    • 分支
    • +
    • 语言
    • +
    • 路径
    • +
    • 编辑
    • +
    <% if @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %>
    • -
    • 1.0
    • -
    • <%= qa.branch %>
    • -
    • <%= qa.language %>
    • -
    • <%= qa.path %>
    • -
    • <%=link_to "bianji", edit_project__quality_analysis_path(@quality_analysis) %>
    • +
    • <%= qa.branch %>
    • +
    • <%= qa.language %>
    • +
    • <%= qa.path %>
    • +
    • <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true %>
    <% end %> diff --git a/app/views/quality_analysis/edit.js.erb b/app/views/quality_analysis/edit.js.erb index e69de29bb..4277ae28e 100644 --- a/app/views/quality_analysis/edit.js.erb +++ b/app/views/quality_analysis/edit.js.erb @@ -0,0 +1,8 @@ +$('#ajax-modal').html('<%= escape_javascript( render :partial => 'quality_analysis/edit', :locals => {}) %>'); +showModal('ajax-modal', '615px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","20%").css("left","32%").css("border","3px solid #269ac9"); +$('#ajax-modal').parent().addClass("popbox_polls"); + + diff --git a/config/routes.rb b/config/routes.rb index 5404e4ecf..075aff6e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -790,7 +790,8 @@ RedmineApp::Application.routes.draw do collection do end member do - + match 'update_jenkins_job' + match 'edit' end end # resources :files, :only => [:index, :new, :create] do diff --git a/db/schema.rb b/db/schema.rb index 16f39f6a1..3258f89c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -52,28 +52,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - create_table "application_settings", :force => true do |t| - t.integer "default_projects_limit" - t.boolean "signup_enabled" - t.boolean "signin_enabled" - t.boolean "gravatar_enabled" - t.text "sign_in_text" - t.datetime "created_at" - t.datetime "updated_at" - t.string "home_page_url" - t.integer "default_branch_protection", :default => 2 - t.boolean "twitter_sharing_enabled", :default => true - t.text "restricted_visibility_levels" - t.boolean "version_check_enabled", :default => true - t.integer "max_attachment_size", :default => 10, :null => false - t.integer "default_project_visibility" - t.integer "default_snippet_visibility" - t.text "restricted_signup_domains" - t.boolean "user_oauth_applications", :default => true - t.string "after_sign_out_path" - t.integer "session_expire_delay", :default => 10080, :null => false - end - create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -178,20 +156,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.string "typeName", :limit => 50 end - create_table "audit_events", :force => true do |t| - t.integer "author_id", :null => false - t.string "type", :null => false - t.integer "entity_id", :null => false - t.string "entity_type", :null => false - t.text "details" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" - add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" - add_index "audit_events", ["type"], :name => "index_audit_events_on_type" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -289,17 +253,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" - create_table "broadcast_messages", :force => true do |t| - t.text "message", :null => false - t.datetime "starts_at" - t.datetime "ends_at" - t.integer "alert_type" - t.datetime "created_at" - t.datetime "updated_at" - t.string "color" - t.string "font" - end - create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -598,8 +551,11 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "is_copy", :default => 0 t.integer "visits", :default => 0 t.integer "syllabus_id" + t.string "invite_code" + t.string "qrcode" end + add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" create_table "custom_fields", :force => true do |t| @@ -663,15 +619,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "deploy_keys_projects", :force => true do |t| - t.integer "deploy_key_id", :null => false - t.integer "project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" - create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -721,16 +668,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "created_at" end - create_table "emails", :force => true do |t| - t.integer "user_id", :null => false - t.string "email", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true - add_index "emails", ["user_id"], :name => "index_emails_on_user_id" - create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -753,25 +690,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - create_table "events", :force => true do |t| - t.string "target_type" - t.integer "target_id" - t.string "title" - t.text "data" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "action" - t.integer "author_id" - end - - add_index "events", ["action"], :name => "index_events_on_action" - add_index "events", ["author_id"], :name => "index_events_on_author_id" - add_index "events", ["created_at"], :name => "index_events_on_created_at" - add_index "events", ["project_id"], :name => "index_events_on_project_id" - add_index "events", ["target_id"], :name => "index_events_on_target_id" - add_index "events", ["target_type"], :name => "index_events_on_target_type" - create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -874,15 +792,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" - create_table "forked_project_links", :force => true do |t| - t.integer "forked_to_project_id", :null => false - t.integer "forked_from_project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true - create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -1012,17 +921,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "identities", :force => true do |t| - t.string "extern_uid" - t.string "provider" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" - add_index "identities", ["user_id"], :name => "index_identities_on_user_id" - create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1166,20 +1064,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "private", :default => 0 end - create_table "keys", :force => true do |t| - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "key" - t.string "title" - t.string "type" - t.string "fingerprint" - t.boolean "public", :default => false, :null => false - end - - add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" - add_index "keys", ["user_id"], :name => "index_keys_on_user_id" - create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1191,27 +1075,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "owner_type", :default => 0 end - create_table "label_links", :force => true do |t| - t.integer "label_id" - t.integer "target_id" - t.string "target_type" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" - add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" - - create_table "labels", :force => true do |t| - t.string "title" - t.string "color" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "labels", ["project_id"], :name => "index_labels_on_project_id" - create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1262,47 +1125,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "viewed_count", :default => 0 end - create_table "merge_request_diffs", :force => true do |t| - t.string "state" - t.text "st_commits", :limit => 2147483647 - t.text "st_diffs", :limit => 2147483647 - t.integer "merge_request_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true - - create_table "merge_requests", :force => true do |t| - t.string "target_branch", :null => false - t.string "source_branch", :null => false - t.integer "source_project_id", :null => false - t.integer "author_id" - t.integer "assignee_id" - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "milestone_id" - t.string "state" - t.string "merge_status" - t.integer "target_project_id", :null => false - t.integer "iid" - t.text "description" - t.integer "position", :default => 0 - t.datetime "locked_at" - end - - add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" - add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" - add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" - add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" - add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" - add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" - add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" - add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" - add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true - add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1337,39 +1159,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" - create_table "milestones", :force => true do |t| - t.string "title", :null => false - t.integer "project_id", :null => false - t.text "description" - t.date "due_date" - t.datetime "created_at" - t.datetime "updated_at" - t.string "state" - t.integer "iid" - end - - add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" - add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" - add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true - add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" - - create_table "namespaces", :force => true do |t| - t.string "name", :null => false - t.string "path", :null => false - t.integer "owner_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type" - t.string "description", :default => "", :null => false - t.string "avatar" - end - - add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" - add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true - add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" - add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true - add_index "namespaces", ["type"], :name => "index_namespaces_on_type" - create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1395,31 +1184,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "notes", :force => true do |t| - t.text "note" - t.string "noteable_type" - t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "project_id" - t.string "attachment" - t.string "line_code" - t.string "commit_id" - t.integer "noteable_id" - t.boolean "system", :default => false, :null => false - t.text "st_diff", :limit => 2147483647 - end - - add_index "notes", ["author_id"], :name => "index_notes_on_author_id" - add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" - add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" - add_index "notes", ["created_at"], :name => "index_notes_on_created_at" - add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" - add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" - add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" - add_index "notes", ["project_id"], :name => "index_notes_on_project_id" - add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" - create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1429,49 +1193,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "oauth_access_grants", :force => true do |t| - t.integer "resource_owner_id", :null => false - t.integer "application_id", :null => false - t.string "token", :null => false - t.integer "expires_in", :null => false - t.text "redirect_uri", :null => false - t.datetime "created_at", :null => false - t.datetime "revoked_at" - t.string "scopes" - end - - add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true - - create_table "oauth_access_tokens", :force => true do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", :null => false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", :null => false - t.string "scopes" - end - - add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true - add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" - add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true - - create_table "oauth_applications", :force => true do |t| - t.string "name", :null => false - t.string "uid", :null => false - t.string "secret", :null => false - t.text "redirect_uri", :null => false - t.string "scopes", :default => "", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - end - - add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" - add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true - create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1629,23 +1350,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "allow_teacher", :default => 0 end - create_table "permissions", :force => true do |t| - t.string "controller", :limit => 30, :default => "", :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "description", :limit => 60, :default => "", :null => false - t.boolean "is_public", :default => false, :null => false - t.integer "sort", :default => 0, :null => false - t.boolean "mail_option", :default => false, :null => false - t.boolean "mail_enabled", :default => false, :null => false - end - - create_table "permissions_roles", :id => false, :force => true do |t| - t.integer "permission_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - end - - add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" - create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1728,11 +1432,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "project_import_data", :force => true do |t| - t.integer "project_id" - t.text "data" - end - create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1823,24 +1522,13 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - create_table "protected_branches", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "developers_can_push", :default => false, :null => false - end - - add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" - create_table "quality_analyses", :force => true do |t| t.integer "project_id" t.string "author_login" t.string "rep_identifier" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "version", :default => 0.0 - t.integer "sonar_version", :default => 1 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 t.string "path" t.string "branch" t.string "language" @@ -1981,25 +1669,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "is_teacher_score", :default => 0 end - create_table "services", :force => true do |t| - t.string "type" - t.string "title" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "active", :default => false, :null => false - t.text "properties" - t.boolean "template", :default => false - t.boolean "push_events", :default => true - t.boolean "issues_events", :default => true - t.boolean "merge_requests_events", :default => true - t.boolean "tag_push_events", :default => true - t.boolean "note_events", :default => true, :null => false - end - - add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" - add_index "services", ["project_id"], :name => "index_services_on_project_id" - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -2038,26 +1707,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "snippets", :force => true do |t| - t.string "title" - t.text "content", :limit => 2147483647 - t.integer "author_id", :null => false - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_name" - t.datetime "expires_at" - t.string "type" - t.integer "visibility_level", :default => 0, :null => false - end - - add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" - add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" - add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" - add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" - add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" - add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" - create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -2196,17 +1845,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "subscriptions", :force => true do |t| - t.integer "user_id" - t.integer "subscribable_id" - t.string "subscribable_type" - t.boolean "subscribed" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true - create_table "syllabuses", :force => true do |t| t.string "title" t.text "description" @@ -2457,17 +2095,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" - create_table "users_star_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" - add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true - add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" - create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2519,23 +2146,6 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.datetime "updated_at", :null => false end - create_table "web_hooks", :force => true do |t| - t.string "url" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type", :default => "ProjectHook" - t.integer "service_id" - t.boolean "push_events", :default => true, :null => false - t.boolean "issues_events", :default => false, :null => false - t.boolean "merge_requests_events", :default => false, :null => false - t.boolean "tag_push_events", :default => false - t.boolean "note_events", :default => false, :null => false - end - - add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" - add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" - create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" From 2c1e0f534c7e0a5653f4fd081e1290720b8da76a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 1 Jul 2016 11:11:53 +0800 Subject: [PATCH 37/67] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/syllabuses_controller.rb | 26 ++++- app/controllers/users_controller.rb | 4 +- app/helpers/syllabuses_helper.rb | 34 +++++++ app/helpers/users_helper.rb | 8 +- app/models/syllabus.rb | 21 ++++- app/views/admin/course_resource_list.html.erb | 2 +- app/views/boards/_course_show.html.erb | 2 +- app/views/courses/_copy_course.html.erb | 2 +- .../courses/_course_activity_users.html.erb | 8 +- app/views/courses/_course_heroes.html.erb | 4 +- .../courses/_join_private_course.html.erb | 10 +- .../courses/_show_member_act_score.html.erb | 4 +- app/views/courses/new.html.erb | 2 +- app/views/courses/show.html.erb | 2 +- app/views/files/_import_files.html.erb | 16 ++-- app/views/files/_show_quote_resource.html.erb | 2 +- app/views/layouts/_logined_header.html.erb | 2 +- app/views/layouts/_project_info.html.erb | 6 +- .../layouts/_show_messages_list.html.erb | 24 ++--- .../layouts/_syllabus_base_info.html.erb | 58 ++++++++++++ .../layouts/_syllabus_edit_info.html.erb | 27 ++++++ app/views/layouts/_syllabus_eng_name.html.erb | 8 ++ app/views/layouts/_syllabus_info.html.erb | 18 ++-- app/views/layouts/_unlogin_header.html.erb | 2 +- app/views/layouts/_user_courses.html.erb | 8 +- app/views/layouts/base_syllabus.html.erb | 34 +------ app/views/layouts/base_users_new.html.erb | 2 +- app/views/layouts/new_base_user.html.erb | 4 +- app/views/news/_course_news.html.erb | 2 +- .../organizations/_org_course_create.html.erb | 2 +- .../_org_course_homework.html.erb | 2 +- .../_org_course_message.html.erb | 2 +- .../organizations/_org_course_news.html.erb | 2 +- .../syllabuses/edit_syllabus_eng_name.js.erb | 3 + app/views/syllabuses/new.html.erb | 6 +- app/views/syllabuses/show.html.erb | 4 +- app/views/syllabuses/update_base_info.js.erb | 2 + app/views/test/courselist.html.erb | 2 +- app/views/users/_course_attachment.html.erb | 2 +- app/views/users/_course_create.html.erb | 2 +- app/views/users/_course_form.html.erb | 4 +- app/views/users/_course_homework.html.erb | 2 +- .../users/_course_journalsformessage.html.erb | 2 +- app/views/users/_course_message.html.erb | 2 +- app/views/users/_course_news.html.erb | 2 +- .../users/_selector_for_messages.html.erb | 6 +- app/views/users/_user_message_course.html.erb | 94 +++++++++---------- .../users/_user_resource_type_filter.html.erb | 2 +- app/views/users/_user_syllabus_list.html.erb | 4 +- app/views/users/show.html.erb | 2 +- .../welcome/_search_all_results.html.erb | 2 +- .../welcome/_search_course_results.html.erb | 6 +- app/views/welcome/search.html.erb | 2 +- config/locales/courses/en.yml | 2 +- config/locales/courses/zh.yml | 6 +- config/locales/zh.yml | 26 ++--- config/routes.rb | 2 + .../20160630112733_rename_syllabus_column.rb | 8 ++ db/schema.rb | 21 ++++- public/assets/wechat/course_discussion.html | 2 +- public/assets/wechat/course_notice.html | 2 +- public/javascripts/application.js | 11 --- public/javascripts/course.js | 18 ++-- public/javascripts/syllabus.js | 80 ++++++++++++++++ 64 files changed, 465 insertions(+), 214 deletions(-) create mode 100644 app/views/layouts/_syllabus_base_info.html.erb create mode 100644 app/views/layouts/_syllabus_edit_info.html.erb create mode 100644 app/views/layouts/_syllabus_eng_name.html.erb create mode 100644 app/views/syllabuses/edit_syllabus_eng_name.js.erb create mode 100644 app/views/syllabuses/update_base_info.js.erb create mode 100644 db/migrate/20160630112733_rename_syllabus_column.rb diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index 54d1c7569..b1d7bf32d 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class SyllabusesController < ApplicationController include ApplicationHelper helper :attachments @@ -5,7 +6,7 @@ class SyllabusesController < ApplicationController include CoursesHelper before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy] - before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist] + before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :update_base_info] def index user = User.current @syllabuses = user.syllabuses @@ -71,7 +72,7 @@ class SyllabusesController < ApplicationController #删除课程大纲的描述 def destroy - if @syllabus and @syllabus.courses.empty? + if @syllabus && @syllabus.courses.empty? @syllabus.destroy redirect_to user_path(User.current.id) end @@ -122,6 +123,27 @@ class SyllabusesController < ApplicationController end end + #修改英文名称 + def edit_syllabus_eng_name + if @syllabus + @syllabus.update_column("eng_name",params[:eng_name]) + end + respond_to do |format| + format.js + end + end + + #编辑属性 + def update_base_info + if @syllabus + @syllabus.update_attributes(:credit => params[:credit], :hours => params[:hours], :theory_hours => params[:theory_hours], :practice_hours => params[:practice_hours], :applicable_major => params[:applicable_major], :pre_course => params[:pre_course]) + @syllabus.update_attributes(:syllabus_type => params[:syllabus_type]) + respond_to do |format| + format.js + end + end + end + private def find_syllabus @syllabus = Syllabus.find params[:id] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 68e7f5590..411f47f1e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1372,7 +1372,7 @@ class UsersController < ApplicationController @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) @all_count = @user.courses.visible.where("is_delete =?", 0).count elsif @type == 'Syllabus' - @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first + @syllabus = Syllabus.where("id = #{params[:syllabus]}").first @courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) @all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count end @@ -3205,7 +3205,7 @@ class UsersController < ApplicationController # end @syllabus.each do |syllabus| count = 0 - courses = @courses.select("syllabus_id = #{syllabus.id}") + courses = @courses.where("syllabus_id = #{syllabus.id}") courses.each do |c| count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) end diff --git a/app/helpers/syllabuses_helper.rb b/app/helpers/syllabuses_helper.rb index af5472ee1..00331e0dc 100644 --- a/app/helpers/syllabuses_helper.rb +++ b/app/helpers/syllabuses_helper.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module SyllabusesHelper def get_syllabuses_by_tag(tag_name) Syllabus.tagged_with(tag_name).order('updated_at desc') @@ -35,4 +36,37 @@ module SyllabusesHelper end count end + + #课程性质下拉框 + def syllabus_type + type = [] + option1 = [] + option2 = [] + option3 = [] + option4 = [] + option5 = [] + option6 = [] + + option1 << "请选择" + option1 << 1 + option2 << "公共必修课" + option2 << 2 + option3 << "学科必修课" + option3 << 3 + option4 << "专业选修课" + option4 << 4 + option5 << "实践必修课" + option5 << 5 + option6 << "实践选修课" + option6 << 6 + + type << option1 + type << option2 + type << option3 + type << option4 + type << option5 + type << option6 + + type + end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 4a6dbc6b6..f312d2275 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -32,7 +32,7 @@ module UsersHelper def get_resource_type type case type when 'Course' - '课程资源' + '班级资源' when 'Project' '项目资源' when 'Issue' @@ -122,11 +122,11 @@ module UsersHelper when 'homework' '作业消息' when 'course_message' - '课程讨论' + '班级讨论' when 'course_news' - '课程通知' + '班级通知' when 'poll' - '课程问卷' + '班级问卷' when 'issue' '项目任务' when 'forge_message' diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb index 2f2ec495f..5e368f341 100644 --- a/app/models/syllabus.rb +++ b/app/models/syllabus.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class Syllabus < ActiveRecord::Base include Redmine::SafeAttributes include ApplicationHelper @@ -8,13 +9,29 @@ class Syllabus < ActiveRecord::Base belongs_to :user has_many :courses has_many :journals_for_messages, :as => :jour, :dependent => :destroy - attr_accessible :description, :title, :eng_name, :type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course - safe_attributes 'title', 'description', 'eng_name', 'type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course' + attr_accessible :description, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course + safe_attributes 'title', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course' def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS end + def syllabus_type_str + case self.syllabus_type + when 1 + type = "公共必修课" + when 2 + type = "学科必修课" + when 3 + type = "专业选修课" + when 4 + type = "实践必修课" + when 5 + type = "实践选修课" + end + type + end + ###添加回复 def self.add_syllabus_jour(user, notes, id , options = {}) syllabus = Syllabus.find(id) diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index 2e83a96aa..4786bbe89 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -39,7 +39,7 @@ <%= number_to_human_size(resource.filesize)%> - 课程资源 + 班级资源 <%= format_date(resource.created_on)%> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index d33b75f82..46191b5d3 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -22,7 +22,7 @@
    - 课程问答区 + 班级问答区
    diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index 3fa0ee9fc..c1c4d1c2f 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -98,7 +98,7 @@
  • id="course_is_public" name="course[is_public]" type="checkbox" value="<%=@course.is_public.to_i %>"> - (选中后班级外用户可见该课程,否则仅对班级内成员可见) + (选中后班级外用户可见该班级,否则仅对班级内成员可见)
  • diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb index 93e0e7b77..3b19de355 100644 --- a/app/views/courses/_course_activity_users.html.erb +++ b/app/views/courses/_course_activity_users.html.erb @@ -2,9 +2,9 @@

      <% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %> - <%= link_to "课程活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %> + <%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %> <% else %> - 课程活跃度 + 班级活跃度 <% end %> 积分规则

      @@ -17,7 +17,7 @@ 问答回复:回复数 x 1
      作业留言:留言数 x 1
      通知留言:留言数 x 1
      - 课程留言:留言数 x 1
      + 班级留言:留言数 x 1
      总得分为以上得分之和
  • <% contributor_course_scor(course.id).each do |contributor_score| %> @@ -47,7 +47,7 @@ 通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %>
    <%# end %> <%# unless contributor_score.journal_num.to_i == 0 %> - 课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %>
    + 班级留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %>
    <%# end %> <%# unless contributor_score.homework_journal_num.to_i == 0 %> <%# end %> diff --git a/app/views/courses/_course_heroes.html.erb b/app/views/courses/_course_heroes.html.erb index 9542f87a9..ea05eea53 100644 --- a/app/views/courses/_course_heroes.html.erb +++ b/app/views/courses/_course_heroes.html.erb @@ -3,9 +3,9 @@

      <% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %> - <%= link_to "课程英雄榜", course_member_path(course, :role => 2), :class => '' %> + <%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => '' %> <% else %> - 课程英雄榜 + 班级英雄榜 <% end %> 积分规则

      diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 96c9a2b7d..ec5d18c7e 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -2,7 +2,7 @@ - 快速进入课程通道 + 快速进入班级通道