diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 7784f68a7..3b660b434 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -151,8 +151,7 @@ class ChallengesController < ApplicationController end end end - - redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]) + redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]), notice: 'Succeed' rescue Exception => e flash[:error] = "#{e.message}" redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]) 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..796a3e72b 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| @@ -548,7 +569,10 @@ class GamesController < ApplicationController # 判断成员是否允许查看 def allowd_view - render_403 if (@game.status == 3 && User.current.id != @myshixun.shixun.try(:user_id)) + if @myshixun.shixun.try(:status) == 2 && @game.status == 3 && User.current.id != @myshixun.shixun.try(:user_id) + render_403 + end + # render_403 if (@game.status == 3 && User.current.id != @myshixun.shixun.try(:user_id)) end def find__shixun_language 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/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index b8b155b07..412ff24f0 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -39,7 +39,7 @@ 上一阶段 <% end %> <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> - + +实践任务 +多选任务 +单选任务 @@ -58,7 +58,7 @@
  • "> 参考答案
  • -
  • "> @@ -79,11 +79,23 @@ <%= render :partial => "edit_scoring" %> <% elsif @tab == 5 %> <%= render :partial => "edit_skill" %> - <%# elsif @tab == 6 %> + <%# elsif @tab == 6 %> <%#= render :partial => "edit_propaedeutics" %> <% end %>
    已保存
    -
    \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 2ea12ceb1..6a03017a2 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -1,5 +1,5 @@
    -
    +

    在线课堂

    @@ -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/_file_edit_form.html.erb b/app/views/games/_file_edit_form.html.erb index 9876917e5..886aa15b4 100644 --- a/app/views/games/_file_edit_form.html.erb +++ b/app/views/games/_file_edit_form.html.erb @@ -123,6 +123,9 @@ // codemmirror键盘按下事件,用来触发自动补全代码功能 editor_CodeMirror.on("keyup", function(editor, event) { + <% if @myshixun.shixun.language == "Html" %> + return; + <% end %> var __Cursor = editor.getDoc().getCursor(); var __Token = editor.getTokenAt(__Cursor); /* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示 diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index 9fdf304f3..14b5af39f 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -18,113 +18,10 @@
    - - \ 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..29e3f87cf 100644 --- a/app/views/games/_games_list.html.erb +++ b/app/views/games/_games_list.html.erb @@ -8,19 +8,33 @@
    <%= 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) %>

    - - <% end %> + + <% if game.try(:status) == 0 %> +

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

    + <% if @myshixun.shixun.try(:status) == 2 %> + + <% end %> + <% elsif game.try(:status) == 1 %> + <% if @myshixun.shixun.try(:status) == 2 %> +

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

    + 正在解决 + <% else %> +

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

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

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

    + <% if @myshixun.shixun.try(:status) == 2 %> + + <% end %> + <% elsif game.try(:status) == 3 %> + <% if @myshixun.shixun.try(:status) == 2 %> +

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

    + + <% else %> +

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

    + <% end %> + <% end %> +
    <% if game.try(:status) == 0 || game.try(:status) == 1 || game.try(:status) == 3 %> diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb index 5a77fe9ca..49a506214 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 b9c25aae9..79944c251 100644 --- a/public/javascripts/edu/edu_tpi.js +++ b/public/javascripts/edu/edu_tpi.js @@ -12,20 +12,16 @@ $(function(){ var wrapWidth; var wrapHeight; lab.live('mousedown',function(){ - dragging = true; leftOffset = $(".labelN").offset().left; wrapWidth = $(".labelN").width(); - return false; } ); cen.live('mousedown',function(){ - flag = true; topOffset = $(".centerH").offset().top; wrapHeight = $(".centerH").height(); - return false; } ); @@ -40,9 +36,9 @@ $(function(){ $("#game_left_contents").width( clickX-leftOffset + 'px'); nextW2 = clickX-leftOffset; $("#game_right_contents").width( wrapWidth - nextW2 + 'px'); + //console.log(lab.next().width()); } else { lab.css('left', '0px'); - } } if(flag){ @@ -59,22 +55,19 @@ $(function(){ var rows = parseInt(m / 18); $("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h); $("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h); - } else { cen.css('top', '0px'); - } } }); - doc.live("mouseup",function(e) { - + doc.live("mouseup", function(e) { flag = false; dragging = false; e.cancelBubble = true; $(".-brother").hide(); // 代码行的遮罩隐藏 - }); + // end; //解決IE瀏覽器大小改變時webssh佈局變亂。 window.onresize = function(){ @@ -93,17 +86,14 @@ $(function(){ // 点击全部任务向右侧展开 $("#all_task_show").on("click", function(e){ c = 0; - // if($("#all_task_index").css("left") == 0 +"px"){ - $("#all_task_tab").removeClass('leftnav-active'); - $("#all_task_show").css("background","rgba(0,0,0,0)"); - $("#all_task_index").css("left", 0).stop().animate({ - left: "-505px" - }, 400, function(){ - $("#all_task_show").hide(); - fadein = 0; - }); - // } - + $("#all_task_tab").removeClass('leftnav-active'); + $("#all_task_show").css("background","rgba(0,0,0,0)"); + $("#all_task_index").css("left", 0).stop().animate({ + left: "-505px" + }, 400, function(){ + $("#all_task_show").hide(); + fadein = 0; + }); }); // end @@ -290,12 +280,12 @@ function game_praise(obj_id, obj_type){ praiseStatus = true; //已赞 praise_count.html(data.praise_tread_count); $("#game_praise_tread").children("i").addClass("color-light-green"); - $("#game_praise_tread").attr("data-tip-down", "取消点赞") + $("#game_praise_tread").attr("title", "取消点赞") }else{ praiseStatus = false; //取消赞 praise_count.html(data.praise_tread_count); $("#game_praise_tread").children("i").removeClass("color-light-green"); - $("#game_praise_tread").attr("data-tip-down", "点赞") + $("#game_praise_tread").attr("title", "点赞") } } }); @@ -316,12 +306,12 @@ function game_tread(obj_id){ treadStatus = true; // 取消踩 tread_count.html(data.praise_tread_count); $("#game_tread").children("i").addClass("color-orange"); - $("#game_tread").attr("data-tip-down", "取消踩") + $("#game_tread").attr("title", "取消踩") }else{ treadStatus = false; // 已踩 tread_count.html(data.praise_tread_count); $("#game_tread").children("i").removeClass("color-orange"); - $("#game_tread").attr("data-tip-down", "踩"); + $("#game_tread").attr("title", "踩"); } } }); @@ -386,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 5815d9183..596056825 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -50,6 +50,7 @@ textarea{resize: none;} .color-orange04{color: #ee4a20!important;}/*温馨提示公用颜色*/ .color-orange05{color: #FF9e6a!important;} a.color-orange05:hover,i.color-orange05:hover{color:#ff7500!important;} +.color-orange06{color:#FF6610!important;} .color-yellow{color:#f0ad4e!important;} .color-yellow2{color:#ff9933!important;} @@ -97,10 +98,11 @@ a:hover.link-color-grey03{color:#3498db!important;} .mb5{ margin-bottom: 5px;}.mb10{ margin-bottom: 10px;}.mb15{ margin-bottom: 15px;}.mb20{ margin-bottom: 20px;}.mb25{ margin-bottom: 25px;}.mb30{ margin-bottom: 30px;}.mb40{ margin-bottom: 40px;}.mb50{ margin-bottom: 50px;} .ml-3{ margin-left: -3px;}.ml5{ margin-left: 5px;}.ml6{ margin-left: 6px;}.ml10{ margin-left: 10px;}.ml15{ margin-left: 15px;}.ml20{ margin-left: 20px;}.ml25{ margin-left: 25px;}.ml30{ margin-left: 30px;}.ml33{ margin-left: 33px;}.ml35{ margin-left:35px;}.ml40{margin-left:40px;}.ml42{margin-left:42px;}.ml50{ margin-left: 50px;}.ml75{ margin-left: 75px;}.ml95{ margin-left: 95px;}.ml115{margin-left: 115px}.ml230{ margin-left: 230px;} .mr3{margin-right: 3px}.mr5{ margin-right: 5px;}.mr10{ margin-right: 10px;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr40{margin-right:40px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;} -.pt5{ padding-top:5px;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt20{ padding-top:20px;}.pt30{ padding-top:30px;} +.pt5{ padding-top:5px;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt20{ padding-top:20px;}.pt30{ padding-top:30px;}.pt40{ padding-top:40px;} .pb5{ padding-bottom:5px;}.pb10{ padding-bottom:10px;}.pb15{ padding-bottom:15px;}.pb20{ padding-bottom:20px;}.pb30{ padding-bottom:30px;} .pl5{ padding-left:5px;}.pl8{ padding-left:8px;}.pl10{ padding-left:10px;}.pl15{ padding-left:15px;}.pl20{ padding-left:20px;}.pl30{ padding-left:30px;}.pl50{ padding-left:50px;}.pl35{ padding-left:35px;} .pr5{ padding-right:5px;}.pr10{ padding-right:10px;}.pr15{ padding-right:15px;}.pr20{ padding-right:20px!important;}.pr30{ padding-right:30px!important;} +.pb40{ padding-bottom:40px;} .padding15{ padding:15px;} .h24{ height: 24px;} @@ -183,7 +185,7 @@ a.course-bth-blue{cursor: pointer;background-color:#199ed8 ;color: #ffffff !impo /*pre标签换行*/ .break_word{word-break: break-all;word-wrap: break-word;} .break_word_firefox{white-space: pre-wrap !important;word-break: break-all;} -.pre_word{white-space: pre-wrap;word-wrap: break-word;} +.pre_word{white-space: pre-wrap;word-wrap: break-word;word-break: normal;} .pr {position:relative;} .df {display:flex;} .w100{width: 100px;} @@ -404,7 +406,7 @@ input::-ms-clear{display:none;} /*---------------边框-----------------*/ .bor-gray-c{border:1px solid #ccc;} .bor-grey-e{border:1px solid #eee;} - +.bor-grey01{border:1px solid #E6EAEB;} /*-------------------------tip样式-------------------------*/ /*.-task-title{opacity:0;position:absolute;left:0;top:0;display:none;}*/ /*.-task-desc-title{background:#000;color:#fff;box-shadow:0px 0px 8px #194a81;max-width:300px;word-wrap: break-word;text-align:center;border-radius:10px;padding:0 10px;}*/ @@ -438,13 +440,19 @@ input::-ms-clear{display:none;} /*-------------------------圆角-------------------------*/ .bor-radius-upper{border-radius: 4px 4px 0px 0px;} +.bor-radius4{border-radius: 4px;} .bor-radius-all{border-radius: 50%;} /*-------------------------旋转-------------------------*/ .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 diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css index 322ac57e6..eb2fd3aa7 100644 --- a/public/stylesheets/css/edu-public.css +++ b/public/stylesheets/css/edu-public.css @@ -283,6 +283,8 @@ a:hover.task-btn-line{ border:1px solid #3498db;background:#3498db;color: #fff;} /*阴影+边框*/ .shadow_border{border:1px solid #eee;-webkit-box-shadow: 0 0 8px 0 rgba(142,142,142,.1);-moz-box-shadow: 0 0 8px 0 rgba(142,142,142,.1);box-shadow: 0 0 8px 0 rgba(142,142,142,.1);} .shadow_border_notop{border:1px solid #eee;-webkit-box-shadow: 0 3px 8px 0 rgba(142,142,142,.1);-moz-box-shadow: 0 3px 8px 0 rgba(142,142,142,.1);box-shadow: 0 3px 8px 0 rgba(142,142,142,.1);} +.user_bg_shadow01{-webkit-box-shadow: 0 1px 2px 2px rgba(123, 123, 123, 0.15);-moz-box-shadow: 0 1px 2px 2px rgba(123, 123, 123, 0.15);box-shadow: 0 1px 2px 2px rgba(123, 123, 123, 0.15);} + /*新增的公用样式*/ .box-boxshadow{box-shadow: 3px 3px 10px rgba(146, 153, 169, 0.2);} diff --git a/public/stylesheets/css/edu-subject.css b/public/stylesheets/css/edu-subject.css index e548de3bd..a5468e6a3 100644 --- a/public/stylesheets/css/edu-subject.css +++ b/public/stylesheets/css/edu-subject.css @@ -3,15 +3,15 @@ /*linear-gradient(to right, rgb(68, 190, 164) 0%, rgb(62, 158, 207) 100%)*/ .box_bg_shandow{box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);} -.active-class .content .pre_sub-con{width:23.87%;margin: 0 1.5% 2.55% 0px;height: 269px;} -.active-class .content .pre_sub-con:nth-child(4n+0){margin:0 0 2.55% 0;} +.active-class .content .pre_sub-con{width:23.87%;margin: 0 1.5% 40px 0px;height: 298px;} +.active-class .content .pre_sub-con:nth-child(4n+0){margin:0 0 40px 0;} .active-class .content .pre_sub-con:hover{cursor: pointer;-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1;} .pre-book{height: 100%;position:absolute;} .subject-box{padding: 20px;background: #fff;text-align: center;position: relative;} -.unit-name{line-height: 17px;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;height: 32px; word-wrap: break-word;} +.unit-name{line-height: 17px;height: 17px;width:196px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} -.active-class .content .sub-con{width:23.69%;border:1px solid #eee;background:#fff;margin: 0 1.5% 1.5% 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);} -.active-class .content .sub-con:nth-child(4n+0){margin:0 0 1.5% 0;} +.active-class .content .sub-con{width:23.69%;border:1px solid #eee;background:#fff;margin: 0 1.5% 30px 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);} +.active-class .content .sub-con:nth-child(4n+0){margin:0 0 30px 0;} .active-class .content .sub-con:hover{box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.15);cursor: pointer;-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1;} @-webkit-keyframes bounce-down { 25% {margin-top:-10px;} @@ -72,6 +72,7 @@ li.li-width7{width: 7%;text-align: left} .stage-name-label{width: 10%;text-align: center;line-height: 40px;} .add-sx{padding:0px 5px;width: 99%;height: 40px;line-height: 40px;border: 1px dashed #ffbfaa;display: inline-block;color: #cccccc;} .bewrite{width: 90%;margin-left: 10px;border-color: #eeeeee;padding: 5px;} +.team-append:hover{background:#EFF9FD;cursor: pointer} .box-border{border:1px solid #e1e1e1} .boxborder-dashed-orange{border: 1px dashed #ffbfaa;} diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 309996bc2..7a06866c6 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -229,6 +229,11 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f /*background: linear-gradient(to right, rgb(104, 177, 215) 0%, rgb(1,75,79) 100%);*/ /*background: linear-gradient(to right,#5DDAE4,#23ADC9);*/ .task-index-head-top{ padding:30px;background:#FCA24B;background: linear-gradient(to right, rgb(104, 177, 215) 0%, rgb(1,75,79) 100%);} + +/*.task-index-head-top{ padding:30px;background:#FFA65E;}*/ +.top-xz{position: absolute;border:14px solid #FFFFFF;border-radius: 50%;box-shadow: 0px 2px 10px rgba(142,142,142,0.4); + opacity: 0.4;} + .task-index-head-top-course{padding:30px;background:linear-gradient(to right, rgb(69, 191, 165) 0%, rgb(164, 175, 247) 100%);} /*linear-gradient(to right, rgb(69, 191, 165) 0%, rgb(164, 175, 247) 100%);*/ .task-inde-head-title{ color:#fff; } @@ -238,9 +243,9 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f .task-index-list{ width: 1200px;} -.task-index-list-box{ width:23.69%;margin: 0 1.5% 1.5% 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; } +.task-index-list-box{ width:23.69%;margin: 0 1.5% 30px 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; } .task-index-list-box:hover{-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1; } -.task-index-list-box:nth-child(4n+0) {margin: 0 0 1.5% 0;} +.task-index-list-box:nth-child(4n+0) {margin: 0 0 30px 0;} .task-mg8{ margin:0 15px 15px 0px; border-radius:2px; border:1px solid #eee; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color:#666; position:relative; } .task-index-list-box-top{padding:16px; padding-top:30px; background:#fff; text-align: center; position:relative; height: 160px;} .task-index-list-title{ max-width:80%; display: block; margin:10px auto 0px; font-size:14px; font-weight: bold;} @@ -319,7 +324,7 @@ a.shixun-task-ban-btn{background-color: #c2c4c6;display: inline-block;font-weigh /* 实训首页的搜索 */ .xy_box{padding:16px;height:180px} .task_yx_bo{margin: 0px auto 13px;} -.course-nav-box{padding:0px 10px;margin:20px 0px} +.course-nav-box{padding:0px 10px;margin:30px 0px} .xy_level{width: 80%;margin: 0px auto;border-top: 1px solid #eee;margin-top: 5px;line-height: 35px;} .course-nav-row{padding:7px 0px} .course-nav-row_item li{width:auto;height: 30px;line-height: 30px;margin: 5px;padding:0px 15px;}