diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a0faf463a..8ed9cfc18 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -49,17 +49,17 @@ class CoursesController < ApplicationController @syllabuses_num = Course.where("is_end = #{@is_end} and is_delete = 0").count #@syllabus_count = all_syllabuses.count # 我创建的课堂 - create_syllabuses = Course.where(:tea_id => @user.id).where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") + create_syllabuses = Course.where(:tea_id => @user.id) # 我参与的课堂 - join_syllabuses = @user.courses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'") + join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}") @join_syllabuses_count = join_syllabuses.count @create_syllabuses_count = create_syllabuses.count # 页面筛选的课程 if @select == "create" - @syllabuses = create_syllabuses + @syllabuses = create_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") elsif @select == "join" - @syllabuses = join_syllabuses + @syllabuses = join_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'") elsif @select == "end" # 归档的课堂 end_syllabuses = Course.where("is_end = #{@is_end} and name like '%#{@search}%'") diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d6b9d3c7f..6aab46616 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -3,7 +3,7 @@ class GamesController < ApplicationController layout "base_myshixun" skip_before_filter :verify_authenticity_token, :only => [:file_update] before_filter :find_myshixun, :only => [:index] - before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, + before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :get_waiting_time, :game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show] before_filter :allowd_manager @@ -147,6 +147,25 @@ class GamesController < ApplicationController end end + # 获取评测的等待的时间 + # res['waitNum'] 评测等待人数 + # res['waitingTime'] 评测等待时间 + # res['onRun'] 0 表示在等待中 1 表示可执行 + def get_waiting_time + shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + uri = "#{shixun_tomcat}/bridge/game/getWaitingTime" + params = {:tpiID => "#{@myshixun.id}"} + res = uri_exec uri, params + if (res && res['code'] != 0) + @message = "实训云平台繁忙(繁忙等级:94)" + raise("实训云平台繁忙(繁忙等级:94)") + end + render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'] } + #render :json => {:result => "success", :onRun => 1, :waitNum => 12, :waitingTime => 546 } + rescue Exception => e + render :json => {:result => "failed"} + end + # status 0: 未提交测评或者提交测评失败后报错;1:中间状态还没返回值;2:返回值并成功 # resubmit 唯一随机码,为了区分每一次重新评测结果 CODES = %W(1 2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) @@ -359,7 +378,9 @@ class GamesController < ApplicationController # 自动推送下一个任务 def next_step - render_403 if @game.status != 2 + unless show_next_stage?(@game, @myshixun.shixun.try(:status)) + render_403 + end next_game = @game.next_game next_game.update_attributes(:status => 0, :open_time => Time.now) if next_game.status == 3 respond_to do |format| diff --git a/app/controllers/iframes_controller.rb b/app/controllers/iframes_controller.rb index 9fed6add6..2d1091219 100644 --- a/app/controllers/iframes_controller.rb +++ b/app/controllers/iframes_controller.rb @@ -1,5 +1,7 @@ class IframesController < ApplicationController layout false + skip_before_filter :verify_authenticity_token, :only => [:html_content] + def show render :layout => false end diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b321cd469..4bdf16e72 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -185,7 +185,7 @@ class ManagementsController < ApplicationController end if params[:support_shixuns] - @major = @major.where(:support_shixuns => params[:support_shixuns].to_i, :major_level => 2) + @major = @major.where(:support_shixuns => params[:support_shixuns].to_i,:major_level=> 2) end @major = @major.order("created_at #{@sx_order}") @@ -652,6 +652,7 @@ end def class_shixuns @menu_type = 4 @sub_type = 1 + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] @edit_class_sx_num=Subject.where(:status => 0).count @audit_class_sx_num=Subject.where(:status => 1).count @publish_class_sx_num=Subject.where(:status => 2).count @@ -680,6 +681,8 @@ end user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id)) @schools = School.where(:id => user_exs.map(&:school_id)) end + @c_shixuns = @c_shixuns.order("created_at #{@sx_order}") + @c_shixuns_count = @c_shixuns.count limit = 20 @c_shixuns_pages = Paginator.new @c_shixuns_count, limit, params['page'] || 1 @@ -700,6 +703,7 @@ end def class_publish_shixuns @menu_type = 4 @sub_type = 2 + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] search = params[:search] # 搜索字 keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 if params[:school_id] && params[:school_id] != '0' @@ -719,7 +723,7 @@ end user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id)) @schools = School.where(:id => user_exs.map(&:school_id)) end - @c_shixuns = @c_shixuns.order("created_at desc") + @c_shixuns = @c_shixuns.order("created_at #{@sx_order}") @c_shixuns_count = @c_shixuns.count limit = 20 @c_shixuns_pages = Paginator.new @c_shixuns_count, limit, params['page'] || 1 @@ -898,35 +902,56 @@ end =end if params[:member_ids] && params[:trial_whether] == "trial_agree" - params[:member_ids].each do |member| - aUser = ApplyAction.where(:user_id => member, :container_type => "TrialAuthorization") - if aUser.blank? - ApplyAction.create(:user_id => member, :container_type => "TrialAuthorization", :status => 1) - else - aUser.update_all(:status => 1) - end - end + aUser = User.where(:id => params[:member_ids]) + aUser.update_all(:certification => 1) + apply_user = ApplyAction.where(:user_id => params[:member_ids]) + apply_user.update_all(:status => 1) unless apply_user.blank? elsif params[:member_ids] && params[:trial_whether] == "trial_cancel" - ApplyAction.where(:user_id => params[:member_ids], :container_type => "TrialAuthorization").update_all(:status => 2) + User.where(:id => params[:member_ids]).update_all(:certification => 0) + apply_user = ApplyAction.where(:user_id => params[:member_ids]) + apply_user.update_all(:status => 2) unless apply_user.blank? end - if params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_agree") + if params[:member_ids] && params[:occupation] == "occupation_agree" + User.where(:id => params[:member_ids]).update_all(:professional_certification => true) + apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2) + unless apply_user.blank? + apply_user.update_all(:status => 1) + end + elsif params[:member_ids] && params[:realname] == "realname_agree" User.where(:id => params[:member_ids]).update_all(:authentication => true) - elsif params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_cancel") + apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1) + unless apply_user.blank? + apply_user.update_all(:status => 1) + end + elsif params[:member_ids] && params[:occupation] == "occupation_cancel" + User.where(:id => params[:member_ids]).update_all(:professional_certification => false) + apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2) + unless apply_user.blank? + apply_user.update_all(:status => 2) + end + elsif params[:member_ids] && params[:realname] == "realname_cancel" User.where(:id => params[:member_ids]).update_all(:authentication => false) + apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1) + unless apply_user.blank? + apply_user.update_all(:status => 2) + end end if params[:trial] == "-1" apply = ApplyAction.where(:container_type => "TrialAuthorization") apply_id = apply.blank? ? -1 : "(" + apply.map{|a| a.user_id}.join(",") + ")" - apply_user_id = User.where("id not in #{apply_id} and status = 1").all + apply_user_id = User.where("id not in #{apply_id} and status = 1 and certification = 0").all apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] elsif params[:trial] == "-2" apply_user_id = User.where(:status => 1).all apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] - else - apply = ApplyAction.where(:status => params[:trial]) + elsif params[:trial] == "0" + apply = ApplyAction.where(:status => 0) apply_user_id = apply.blank? ? [-1] : apply.map{|a| a.user_id}.split(",")[0] + else + apply_user_id = User.where(:status => 1, :certification => params[:trial]).all + apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] end if params[:school] == "" @@ -1031,6 +1056,7 @@ end end end apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id) + User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1)) user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user) @autu_count = @authorizations.count @@ -1155,6 +1181,7 @@ end format.html end end + # 课程实训发布审批 def deal_subject_authorization apply_action = ApplyAction.find(params[:apply_id]) @@ -1180,6 +1207,7 @@ end format.js end end + # 项目实训发布审批 def deal_shixun_authorization apply_action = ApplyAction.find(params[:apply_id]) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 2fd647c71..e1d4fe631 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -647,10 +647,10 @@ class ShixunsController < ApplicationController # 实训行为操作 def operation + @is_subject = params[:is_subject] @myshixun = Myshixun.where(:id => params[:myshixun_id]).first @is_modify = ShixunModify.where(:myshixun_id => params[:myshixun_id], :shixun_id => @shixun.try(:id), :status => 1).first @mail = User.current.mail.blank? - end private diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c0182bf42..4431c4767 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -668,7 +668,8 @@ class UsersController < ApplicationController @offset ||= @course_result_pages.offset @course_result = paginateHelper @course_result, @limit else - @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc") + # @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc") + @shixuns_result = Shixun.where("name like ?", "%#{@search}%").reorder("created_at desc") @shixuns_result_count = @shixuns_result.count @shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1 @offset ||= @shixun_pages.offset diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e0b2604cb..1d9ab8c00 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,18 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # 定义当前关卡是否有权开启下一关 + # :实训若发布了,必须通过当前关卡才能查看下一关 + # :未发布的实训,除了最后一关,其它的关卡都可以进入下一关 + def show_next_stage?(game, shixun_status) + if game.is_final_game? || ([2,3].include?(shixun_status.to_i) && game.try(:status) != 2) + false + else + true + end + end + + # 适用与已经用url_safe编码后,回调字符串形式 def tran_base64_decode64 str if str.blank? @@ -142,7 +154,7 @@ module ApplicationHelper # if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载 # return true # end - authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first + authentication = User.where(:id => User.current.id, :certification => 1).first user_identity = User.current.try(:user_extensions).try(:identity) if user_identity.blank? || authentication.blank? redirect_to my_account_path @@ -3026,12 +3038,15 @@ module ApplicationHelper end end - def identity_authentication_status status - case status - when nil - "未授权" + def identity_authentication_status user + authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last + case user.try(:certification) when 0 - "处理中" + if authorization.try(:status) == 0 + "处理中" + else + "未授权" + end when 1 "已授权" when 2 diff --git a/app/models/game.rb b/app/models/game.rb index 4b97fbbde..03d1d58ae 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -52,4 +52,9 @@ class Game < ActiveRecord::Base output = outputs.blank? ? nil : outputs.first return output end + + def is_final_game? + challenge = self.challenge + challenge.try(:position).to_i == challenge.shixun.challenges.count ? true : false + end end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index d7ae9ebc0..40c2237f0 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -5,6 +5,7 @@ # 85:challenge创建的时候Jenkins处理异常;86:实训评测失败,jenkins返回错误结果; 87:版本库删除异常;88:点击评测失败,没返回数据;89:重置链接jenkins返回失败 # 90: 更新公共测试用例失败,返回code非0;91:实训有改动,评测的时候初始化数据,返回数据code非0;92:webssh开启失败,接口getConnectInfo返回code值非0 # 93: 实训断开连接失败,接口deleteSSH返回code值非0 +# 94: 获取评测等待时间失败,接口getWaitingTime返回code值为非0 # 116:challenge创建关卡的时候返回结果错误 # class Shixun < ActiveRecord::Base @@ -23,6 +24,7 @@ class Shixun < ActiveRecord::Base has_many :shixun_major_courses, :dependent => :destroy has_and_belongs_to_many :homework_commons has_many :discusses, :as => :dis, :dependent => :destroy + has_many :shixun_ports scope :visible, lambda{where(status: [2,3])} diff --git a/app/models/shixun_port.rb b/app/models/shixun_port.rb new file mode 100644 index 000000000..d7e04b397 --- /dev/null +++ b/app/models/shixun_port.rb @@ -0,0 +1,4 @@ +class ShixunPort < ActiveRecord::Base + attr_accessible :port, :shixun_id + belongs_to :shixun +end diff --git a/app/views/account/user_join.html.erb b/app/views/account/user_join.html.erb index 14399b9d9..1b32e71b5 100644 --- a/app/views/account/user_join.html.erb +++ b/app/views/account/user_join.html.erb @@ -35,7 +35,7 @@

-
  • +
  • -
  • +
  • diff --git a/app/views/challenges/_skill_form.html.erb b/app/views/challenges/_skill_form.html.erb index 21c558c78..c23177dac 100644 --- a/app/views/challenges/_skill_form.html.erb +++ b/app/views/challenges/_skill_form.html.erb @@ -31,7 +31,7 @@ - + @@ -63,6 +63,7 @@ // 获取父节点的id var obj = $(thisObj).parent(); $(obj).remove(); + $("#challenge_skill_update").submit(); } /* $(document).click(function(e){ if(e.target.id==$("#edit_skill").attr("id")||e.target.id==$("#add_knowledge").attr("id")||e.target.className==$(".knowledge_frame").attr("class")||e.target.className==$(".close").attr("class")||e.target.id==$("#shixun_skill_input").attr("id")){ diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index dd74c7494..6a03017a2 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -27,15 +27,15 @@
  • --> -
    -
    -
    + +
    +
    - - + +
    - +
    @@ -49,6 +49,22 @@ <%= render :partial => 'layouts/public_left_info' %> - \ No newline at end of file diff --git a/app/views/games/_games_list.html.erb b/app/views/games/_games_list.html.erb index 7df50e415..c91dfa644 100644 --- a/app/views/games/_games_list.html.erb +++ b/app/views/games/_games_list.html.erb @@ -8,18 +8,20 @@
    <%= challenge.try(:position) %> - <% if game.try(:status) == 0 %> -

    <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %>

    - - <% elsif game.try(:status) == 1 %> -

    <%= challenge.try(:subject) %>

    - 正在解决 - <% elsif game.try(:status) == 2 %> -

    <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %>

    - - <% elsif game.try(:status) == 3 %> -

    <%= challenge.try(:subject) %>

    - + <% if @myshixun.shixun.try(:status) == 2 %> + <% if game.try(:status) == 0 %> +

    <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %>

    + + <% elsif game.try(:status) == 1 %> +

    <%= challenge.try(:subject) %>

    + 正在解决 + <% elsif game.try(:status) == 2 %> +

    <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %>

    + + <% elsif game.try(:status) == 3 %> +

    <%= challenge.try(:subject) %>

    + + <% end %> <% end %>
    diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb index 5533a0e78..68013b7ba 100644 --- a/app/views/games/_repository.html.erb +++ b/app/views/games/_repository.html.erb @@ -20,12 +20,14 @@
    -
    -

    - <%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir'} %> -

    -

    -
    + <% unless [2,3].include?(@myshixun.shixun.try(:status).to_i) %> +
    +

    + <%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir'} %> +

    +

    +
    + <% end %>
    <% if shixun.status == 0 %> - <%= link_to(l(:button_delete), shixun_path(shixun), :method => :delete, :data => { confirm: "确认删除" } ) %> + <%= link_to(l(:button_delete), shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %> <% end %> value="0" id="shixun_hidden_<%= shixun.id %>" name="hidden" class="ml-3 mr5 magic-checkbox"> diff --git a/app/views/managements/_subject_authorization_list.html.erb b/app/views/managements/_subject_authorization_list.html.erb index 403933b91..63671bc55 100644 --- a/app/views/managements/_subject_authorization_list.html.erb +++ b/app/views/managements/_subject_authorization_list.html.erb @@ -1,3 +1,4 @@ +<% unless @authorizations.blank? %> <% @authorizations.each do |authorization| %>
    <% user = authorization.user %> @@ -34,6 +35,9 @@
    <% end %> +<% else %> + <%= render :partial => "welcome/no_data" %> +<% end %> \ No newline at end of file +
    +
    + \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index aef3e6a2d..4686854ee 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -103,7 +103,7 @@ -

    +

    <% update_visiti_count @user %> <%= @user.visits.to_i %> 次访问 diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 3a70d0244..f04106015 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -1,10 +1,10 @@

    - <% str = current_user ? '我' : 'TA' %> + <% str = (current_user == @user) ? '我' : 'TA' %>
    • - <%= str %>的关注 <%= @user_watchlist_count %> + <%= str %>的关注 <%= @user_watchlist_count %>
    • <%= str %>的粉丝 <%= @user_fanlist_count %> @@ -29,4 +29,5 @@ $(this).html() == "关注" ? $(this).html("关注") : $(this).html("已关注"); } }); + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4d0da5f86..ab9e0cdbf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -138,6 +138,7 @@ RedmineApp::Application.routes.draw do resources :games, :path => "stages" do member do match 'game_build', :via => [:get, :post] + match 'get_waiting_time', :via => [:get, :post] match 'next_step', :via => [:get, :post] match 'reset_original_code', :via => [:get, :post] match 'reset_new_code', :via => [:get, :post] @@ -158,7 +159,6 @@ RedmineApp::Application.routes.draw do resources :iframes do collection do - match 'html_content', :via => [:get, :post] end end diff --git a/db/migrate/20170830093154_add_webhook_to_gitlab.rb b/db/migrate/20170830093154_add_webhook_to_gitlab.rb new file mode 100644 index 000000000..6e9a25488 --- /dev/null +++ b/db/migrate/20170830093154_add_webhook_to_gitlab.rb @@ -0,0 +1,10 @@ +class AddWebhookToGitlab < ActiveRecord::Migration + def change + Shixun.where("gpid is not null").each do |shixun| + puts(shixun.id) + g = Gitlab.client + hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{shixun.identifier}" + "/ghook" + g.add_project_hook(shixun.gpid, hook_url) + end + end +end diff --git a/db/migrate/20170831015104_add_certification_to_user.rb b/db/migrate/20170831015104_add_certification_to_user.rb new file mode 100644 index 000000000..780f5a667 --- /dev/null +++ b/db/migrate/20170831015104_add_certification_to_user.rb @@ -0,0 +1,5 @@ +class AddCertificationToUser < ActiveRecord::Migration + def change + add_column :users, :certification, :boolean, :default => 0 + end +end diff --git a/db/migrate/20170831015613_update_apply_action_to_user.rb b/db/migrate/20170831015613_update_apply_action_to_user.rb new file mode 100644 index 000000000..a395d505a --- /dev/null +++ b/db/migrate/20170831015613_update_apply_action_to_user.rb @@ -0,0 +1,11 @@ +class UpdateApplyActionToUser < ActiveRecord::Migration + def up + apply_users = ApplyAction.where(:status => 1, :container_type => "TrialAuthorization") + apply_users.each do |apply| + User.where(:id => apply.user_id).first.update_column(:certification, 1) + end + end + + def down + end +end diff --git a/db/migrate/20170831022201_modify_certification_for_user.rb b/db/migrate/20170831022201_modify_certification_for_user.rb new file mode 100644 index 000000000..bb89c5eb8 --- /dev/null +++ b/db/migrate/20170831022201_modify_certification_for_user.rb @@ -0,0 +1,8 @@ +class ModifyCertificationForUser < ActiveRecord::Migration + def up + change_column :users, :certification, :integer, :default => 0 + end + + def down + end +end diff --git a/db/migrate/20170831022550_update_reject_certication_for_user.rb b/db/migrate/20170831022550_update_reject_certication_for_user.rb new file mode 100644 index 000000000..92706cdf2 --- /dev/null +++ b/db/migrate/20170831022550_update_reject_certication_for_user.rb @@ -0,0 +1,13 @@ +class UpdateRejectCerticationForUser < ActiveRecord::Migration + def up + apply_users = ApplyAction.where(:status => 2, :container_type => "TrialAuthorization") + unless apply_users.blank? + apply_users.each do |apply| + User.where(:id => apply.user_id).first.update_column(:certification, 2) + end + end + end + + def down + end +end diff --git a/db/migrate/20170831092348_create_shixun_ports.rb b/db/migrate/20170831092348_create_shixun_ports.rb new file mode 100644 index 000000000..57d6fd53f --- /dev/null +++ b/db/migrate/20170831092348_create_shixun_ports.rb @@ -0,0 +1,10 @@ +class CreateShixunPorts < ActiveRecord::Migration + def change + create_table :shixun_ports do |t| + t.integer :shixun_id + t.integer :port + + t.timestamps + end + end +end diff --git a/public/javascripts/edu/edu_tpi.js b/public/javascripts/edu/edu_tpi.js index 8310d9244..79944c251 100644 --- a/public/javascripts/edu/edu_tpi.js +++ b/public/javascripts/edu/edu_tpi.js @@ -11,21 +11,21 @@ $(function(){ var flag = false; var wrapWidth; var wrapHeight; - lab.bind('mousedown',function(){ + lab.live('mousedown',function(){ dragging = true; leftOffset = $(".labelN").offset().left; wrapWidth = $(".labelN").width(); return false; } ); - cen.bind('mousedown',function(){ + cen.live('mousedown',function(){ flag = true; topOffset = $(".centerH").offset().top; wrapHeight = $(".centerH").height(); return false; } ); - doc.bind('mousemove',function(e){ + doc.live('mousemove',function(e){ $(".-brother").show();// 代码行的遮罩显示 if(dragging) { @@ -33,9 +33,9 @@ $(function(){ if(clickX > leftOffset+300&&clickX topOffset +100) { cen.css('top', clickY - 7 - topOffset + 'px'); - cen.prev().height( clickY-topOffset + 'px'); + $("#games_repository_contents").height( clickY-topOffset + 'px'); nextW1 = clickY-topOffset; - cen.next().height( wrapHeight - nextW1 + 'px'); + $("#games_valuation_contents").height( wrapHeight - nextW1 + 'px'); var h = $("#games_repository_contents").height() - $("#top_repository").height() - 50; var m = $("#games_repository_contents").height() - 50; $(".game_webssh").css("min-height", m); @@ -61,12 +61,13 @@ $(function(){ } }); - doc.mouseup(function(e) { + doc.live("mouseup", function(e) { flag = false; dragging = false; e.cancelBubble = true; $(".-brother").hide(); // 代码行的遮罩隐藏 }); + // end; //解決IE瀏覽器大小改變時webssh佈局變亂。 window.onresize = function(){ @@ -375,7 +376,10 @@ function code_evaluation(test_sets, $b = "
      " + "
      " + "
      " + - "" + "
      " + "
      "; diff --git a/public/loading.html b/public/loading.html new file mode 100644 index 000000000..7d3df7457 --- /dev/null +++ b/public/loading.html @@ -0,0 +1,14 @@ + +
      +
      +
      EDUCODER
      +

      LOADING

      +
      +
      \ No newline at end of file diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index a47399fea..596056825 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -447,7 +447,12 @@ input::-ms-clear{display:none;} .transform90{transform: rotate(90deg);} /*---------------------编辑器边框------------------------*/ .kindeditor{background: #F0F0EE;height:22px;border:1px solid #CCCCCC;border-bottom: none} +<<<<<<< HEAD /*两端对齐*/ -.justify{text-align: justify;} \ No newline at end of file +.justify{text-align: justify;} +======= +/**/ +#edu-tab-nav .edu-position-hidebox li a{font-size: 12px} +>>>>>>> dev_xucheng