Merge branch 'develop' into dev_daiao
This commit is contained in:
commit
32cc7edba6
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the kubernete controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
|
@ -24,7 +24,7 @@ class AccountController < ApplicationController
|
|||
skip_before_filter :check_if_login_required
|
||||
skip_before_filter :check_authentication, :only => [:login, :logout, :user_join, :avatar, :authentication, :professional_certification, :security_settings, :change_psd]
|
||||
before_filter :auth_login1, :only => [:avatar, :authentication, :professional_certification, :security_settings, :change_psd]
|
||||
|
||||
skip_before_filter :verify_authenticity_token, :only =>[:codepedia_login]
|
||||
before_filter :require_login, only: [:avatar, :authentication, :professional_certification, :security_settings, :change_psd, :user_auth, :apply_auth, :apply_pro_certification, :check_student_id]
|
||||
include ApplicationHelper
|
||||
# Login request and validation
|
||||
|
|
@ -56,6 +56,18 @@ class AccountController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def codepedia_login
|
||||
logger.info("codepedia_login#########################################")
|
||||
logger.info("#{params}")
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
logger.info(user)
|
||||
if user.blank?
|
||||
render :json => { status: 0 }
|
||||
else
|
||||
render :json => { status: 1, user: user}
|
||||
end
|
||||
end
|
||||
|
||||
def user_join
|
||||
if params[:type] == "activated"
|
||||
@message = l(:notice_account_activated)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -40,16 +40,11 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
end
|
||||
# 实训是否需要重启
|
||||
myshixuns = @shixun.myshixuns
|
||||
unless myshixuns.blank?
|
||||
myshixuns.each do |myshixun|
|
||||
shixun_modify = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => myshixun.id).first
|
||||
if shixun_modify.nil?
|
||||
ShixunModify.create(:shixun_id => @shixun.id, :myshixun_id => myshixun.id, :status => 1)
|
||||
else
|
||||
shixun_modify.update_attribute(:status, 1)
|
||||
end
|
||||
end
|
||||
# 非实践任务创建第一个阶段时调用 publishGame, 避免不包含实践任务的实训进行模拟实战时报错
|
||||
if @challenge.position == 1 && params[:st].to_i != 0
|
||||
add_shixun_modify_status @shixun, 1
|
||||
else
|
||||
shixun_modify_status_without_publish(@shixun, 1)
|
||||
end
|
||||
redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)
|
||||
rescue Exception => e
|
||||
|
|
@ -58,35 +53,6 @@ class ChallengesController < ApplicationController
|
|||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
=begin
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@challenge.save!
|
||||
if params[:test_set][:hidden].length > 0
|
||||
params[:test_set][:input].each_with_index do |input, index|
|
||||
params[:test_set][:hidden][index].to_i == 0 ? open = 1 : open = 0
|
||||
unless (input[index] == params[:test_set][:output][index] && input[index].nil?)
|
||||
TestSet.create(:challenge_id => @challenge.id, :input => input, :output => params[:test_set][:output][index], :is_public => open, :position => (index + 1))
|
||||
end
|
||||
end
|
||||
end
|
||||
unless params[:knowledge].blank?
|
||||
params[:knowledge][:input].each do |input|
|
||||
ChallengeTag.create(:name => input, :challenge_id => @challenge.id)
|
||||
end
|
||||
end
|
||||
# 更新shixun公共测试用例
|
||||
add_shixun_modify_status(@shixun, 1)
|
||||
respond_to do |format|
|
||||
format.html {redirect_to shixun_challenge_path(@challenge, :shixun_id => @shixun)}
|
||||
end
|
||||
rescue Exception => e
|
||||
flash[:error] = "#{e.message}"
|
||||
redirect_to new_shixun_challenge_path(:shixun_id => @shixun)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
=end
|
||||
end
|
||||
|
||||
# 处理新建challenge返回的pipeline片段
|
||||
|
|
@ -96,7 +62,7 @@ class ChallengesController < ApplicationController
|
|||
|
||||
def index
|
||||
# 顶部导航
|
||||
@challenges = @shixun.challenges.order("position desc")
|
||||
@challenges = @shixun.challenges.order("position asc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
|
@ -131,10 +97,12 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
next_challenges = @shixun.challenges.where("position > #{@challenge.position}")
|
||||
next_challenges.update_all("position = position - 1")
|
||||
@challenge.destroy
|
||||
respond_to do |format|
|
||||
format.html{redirect_to shixun_challenges_path(@shixun)}
|
||||
end
|
||||
@challenges = @shixun.challenges
|
||||
|
||||
add_shixun_modify_status(@shixun, 1)
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
@ -216,7 +184,7 @@ class ChallengesController < ApplicationController
|
|||
# build job 只负责发送请求
|
||||
def challenge_build
|
||||
gitUrl = git_repository_url(@shixun, "Shixun")
|
||||
gitUrl = Base64.encode64(gitUrl)
|
||||
gitUrl = Base64.urlsafe_encode64(gitUrl)
|
||||
taskId = params[:id]
|
||||
jobName = @shixun.forked_form
|
||||
step = @challenge.position
|
||||
|
|
|
|||
|
|
@ -52,9 +52,11 @@ class DepartmentController < ApplicationController
|
|||
apply_department.user_id = User.current.id
|
||||
if apply_department.save
|
||||
data[:department_id] = department.id
|
||||
user_extention = User.current.extensions
|
||||
user_extention.department_id = department.id
|
||||
user_extention.save!
|
||||
unless User.current.professional_certification
|
||||
user_extention = User.current.extensions
|
||||
user_extention.department_id = department.id
|
||||
user_extention.save!
|
||||
end
|
||||
|
||||
# 向管理员发送信息
|
||||
users = User.where(:admin => 1)
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class GamesController < ApplicationController
|
|||
end
|
||||
# logger.info("#################%%%%%%#{@game.outputs.first.out_put}")
|
||||
# @games = @myshixun.games.includes(:challenge)
|
||||
@game_challenge = @game.challenge
|
||||
@challenges = Challenge.where(:shixun_id => @myshixun.shixun_id)
|
||||
@shixun = @myshixun.shixun
|
||||
@praise_count = PraiseTread.where(:praise_tread_object_id => @challenges, :praise_tread_object_type => "Challenge").count
|
||||
@tread_count = PraiseTread.where(:praise_tread_object_id => @challenges, :praise_tread_object_type => "ChallengeTread").count
|
||||
@praise_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "Challenge").count
|
||||
@tread_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "ChallengeTread").count
|
||||
# @games_count = @games.count
|
||||
@game_challenge = @game.challenge
|
||||
@st = @game_challenge.st
|
||||
@had_done = @game.had_done
|
||||
@praise = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?", @game_challenge.id, @game_challenge.class.to_s, User.current.id).first
|
||||
|
|
@ -68,7 +68,7 @@ class GamesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
@content = Base64.decode64(file_content) unless file_content.blank?
|
||||
@content = tran_base64_decode64(file_content)
|
||||
end
|
||||
if @content.nil?
|
||||
@entries = @repository.entries(@path, @rev)
|
||||
|
|
@ -83,13 +83,13 @@ class GamesController < ApplicationController
|
|||
@test_sets_count = test_sets.count
|
||||
@test_sets_hidden_count = test_sets.blank? ? 0 :test_sets.select{|test_set| test_set.is_public == false}.count
|
||||
@test_sets_public_count = @test_sets_count - @test_sets_hidden_count
|
||||
had_test = @game.outputs
|
||||
had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1))
|
||||
@had_test_count = had_test.count
|
||||
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
|
||||
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
|
||||
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
|
||||
@final_score = ((@game.answer_open? || @shixun.status <= 1) ? 0 : @game.final_score.to_i)
|
||||
@had_done = ((@myshixun.games.where(:status => 2).count == @myshixun.games.count && @game_challenge.position == @myshixun.games.count) ? 1 : 0)
|
||||
@had_done = @game.had_done
|
||||
@language = @game_challenge.shixun.language
|
||||
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last
|
||||
logger.info("latest output id is #{error_position.id unless error_position.blank?}")
|
||||
|
|
@ -109,7 +109,7 @@ class GamesController < ApplicationController
|
|||
def entry
|
||||
# entry_and_raw(false)
|
||||
file_content = @g.files(@myshixun.gpid, @path, @rev).content
|
||||
@content = Base64.urlsafe_decode64(file_content) unless file_content.blank?
|
||||
@content =tran_base64_decode64(file_content)
|
||||
# @content = @repository.cat(@path, @rev)
|
||||
end
|
||||
|
||||
|
|
@ -154,34 +154,24 @@ class GamesController < ApplicationController
|
|||
game_challenge = @game.challenge
|
||||
shixun = @myshixun.shixun
|
||||
gitUrl = git_myshixun_url_ip(@myshixun, @myshixun.try(:user_id))
|
||||
gitUrl = Base64.encode64(gitUrl)
|
||||
gitUrl = Base64.urlsafe_encode64(gitUrl)
|
||||
taskId = @game.id
|
||||
jobName = "myshixun_#{@myshixun.id}"
|
||||
code = CODES.sample(8).join
|
||||
# status为2说明是重新评测
|
||||
if @game.status == 2
|
||||
resubmit = "#{code}_#{@myshixun.id}"
|
||||
else
|
||||
@game.update_attributes!(:status => 1)
|
||||
# 重新评测不影响已通关的实训状态
|
||||
@game.update_attributes!(:status => 1) if resubmit.nil?
|
||||
end
|
||||
|
||||
# 过关后重评不更新状态
|
||||
# if resubmit.nil?
|
||||
# @game.update_attributes!(:status => 1)
|
||||
# end
|
||||
|
||||
# 如果shixun有改动,增需要进行后台的一些更新
|
||||
shixun_mod = ShixunModify.where(:myshixun_id => @myshixun.id, :status => 1).first
|
||||
modifyStatus = 0
|
||||
unless shixun_mod.nil?
|
||||
modifyStatus = 1
|
||||
gameInfo = shixun.gameInfo
|
||||
end
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
gameInfo = shixun.gameInfo
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
step = game_challenge.try(:position)
|
||||
# 注意:这个地方的参数写的时候不能换行
|
||||
params = {:jobNameForInstance => "#{jobName}", :buildID => "#{taskId}", :instanceGitURL => "#{gitUrl}", :instanceChallenge => "#{step}", :resubmit => resubmit, :modifyStatus => "#{modifyStatus}", :gameInfo => "#{gameInfo}"}
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/api/buildJobForInstance")
|
||||
params = {:tpiID => "#{@myshixun.id}", :buildID => "#{taskId}", :instanceGitURL => "#{gitUrl}", :instanceChallenge => "#{step}", :resubmit => resubmit, :operationEnvironment => "#{shixun.try(:language)}"}
|
||||
# uri = URI("#{shixun_tomcat}/bridge/game/gameEvaluate")
|
||||
uri = "#{shixun_tomcat}/bridge/game/gameEvaluate"
|
||||
res = uri_exec uri, params
|
||||
logger.info("#####################buildJobForInstance result is #{res}")
|
||||
logger.info("#####################buildJobForInstance params is #{params}")
|
||||
|
|
@ -190,10 +180,11 @@ class GamesController < ApplicationController
|
|||
raise("实训云平台繁忙(繁忙等级:86)")
|
||||
end
|
||||
render :json => {:result => "success", :resubmit => resubmit}
|
||||
rescue
|
||||
rescue Exception => e
|
||||
if resubmit.nil?
|
||||
@game.update_attributes!(:status => 0)
|
||||
end
|
||||
logger.error("###################" + e.message)
|
||||
#REDO Jenkins服务异常弹框抛出
|
||||
render :json => {:result => "failed"}
|
||||
end
|
||||
|
|
@ -208,6 +199,8 @@ class GamesController < ApplicationController
|
|||
had_done = @game.had_done
|
||||
resubmit_identifier = @game.resubmit_identifier
|
||||
shixun = @myshixun.shixun
|
||||
score = 0
|
||||
tag_count = 0
|
||||
logger.info("##### resubmit_identifier is #{resubmit_identifier}")
|
||||
if params[:resubmit].blank? # 非重新评测
|
||||
if had_done == 1 # 通过最后一关,即所有关卡
|
||||
|
|
@ -218,8 +211,16 @@ class GamesController < ApplicationController
|
|||
@game.update_attribute(:end_time, Time.now)
|
||||
game_passed_code(@game.id, game_challenge.try(:path), @myshixun.try(:gpid), 1)
|
||||
if !@game.answer_open && shixun.status > 1
|
||||
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
reward_grade(@game.user, @game.id, 'Game', game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, 'Game', game_challenge.score)
|
||||
score = game_challenge.score
|
||||
tag_count = game_challenge.challenge_tags.count
|
||||
elsif shixun.status > 1 && @game.answer_open
|
||||
score = -game_challenge.score.to_i
|
||||
tag_count = 0
|
||||
else
|
||||
score = "+0"
|
||||
tag_count = 0
|
||||
end
|
||||
end
|
||||
game_status = @game.status
|
||||
|
|
@ -247,7 +248,7 @@ class GamesController < ApplicationController
|
|||
@test_sets_count = test_sets.count
|
||||
@test_sets_hidden_count = test_sets.blank? ? 0 :test_sets.select{|test_set| test_set.is_public == false}.count
|
||||
@test_sets_public_count = @test_sets_count - @test_sets_hidden_count
|
||||
had_test = @game.outputs
|
||||
had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1))
|
||||
@had_test_count = had_test.count
|
||||
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
|
||||
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
|
||||
|
|
@ -268,7 +269,9 @@ class GamesController < ApplicationController
|
|||
latest_output: @latest_output,
|
||||
status: game_status,
|
||||
had_done: had_done,
|
||||
language: @language}
|
||||
language: @language,
|
||||
score: score,
|
||||
tag_count: tag_count}
|
||||
end
|
||||
|
||||
# 选择题评测(选择题不需要重新评测)
|
||||
|
|
@ -276,6 +279,8 @@ class GamesController < ApplicationController
|
|||
@game_challenge = @game.challenge
|
||||
user_answer = params[:answer]
|
||||
correct = true
|
||||
score = 0
|
||||
tag_count = 0
|
||||
if !user_answer.blank?
|
||||
if user_answer.split("").count != @game_challenge.challenge_questions.where(:right_key => true).count
|
||||
correct = false
|
||||
|
|
@ -295,12 +300,28 @@ class GamesController < ApplicationController
|
|||
had_done = @game.had_done
|
||||
shixun = @myshixun.shixun
|
||||
if shixun.status > 1 && !@game.answer_open
|
||||
User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) if correct
|
||||
if correct
|
||||
#User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score))
|
||||
reward_grade(@game.user, @game.id, 'Game', @game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, 'Game', @game_challenge.score)
|
||||
@game.update_attribute(:final_score, @game_challenge.score)
|
||||
score = @game_challenge.score
|
||||
tag_count = @game_challenge.challenge_tags.count
|
||||
else
|
||||
score = "+0"
|
||||
tag_count = 0
|
||||
end
|
||||
elsif shixun.status > 1 && @game.answer_open
|
||||
score = -@game_challenge.score.to_i
|
||||
tag_count = 0
|
||||
else
|
||||
score = "+0"
|
||||
tag_count = 0
|
||||
end
|
||||
if @game.outputs.blank?
|
||||
Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct)
|
||||
end
|
||||
render :json => {correct: correct, had_done: had_done, :grade => User.current.grade}
|
||||
render :json => {correct: correct, had_done: had_done, :grade => User.where(:id => User.current.id).first.grade, score: score, tag_count: tag_count}
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -321,9 +342,9 @@ class GamesController < ApplicationController
|
|||
# 如果该方法异常则直接返回0,跳过等待
|
||||
def waiting_info
|
||||
begin
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
params = {:buildID => "#{@game.id}"}
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/api/getWaitingTime")
|
||||
uri = URI("#{shixun_tomcat}/jenkins-exec/api/getWaitingTime")
|
||||
res = uri_exec uri, params
|
||||
if (res && res['code'] != 0)
|
||||
raise("获取等待任务数异常")
|
||||
|
|
@ -406,7 +427,7 @@ class GamesController < ApplicationController
|
|||
message = "file reset"
|
||||
update_gitlab_file(content, @path, @rev, message)
|
||||
file_content = @g.files(@myshixun.gpid, @path, @rev).content
|
||||
@content = Base64.decode64(file_content) unless file_content.blank?
|
||||
@content = tran_base64_decode64(file_content)
|
||||
if @content.nil?
|
||||
raise("初始代码为空,代码重置失败")
|
||||
# @entries = @repository.entries(@path, @rev)
|
||||
|
|
@ -433,7 +454,7 @@ class GamesController < ApplicationController
|
|||
message = "file reset"
|
||||
update_gitlab_file(content, @path, @rev, message)
|
||||
file_content = @g.files(@myshixun.gpid, @path, @rev).content
|
||||
@content = Base64.decode64(file_content) unless file_content.blank?
|
||||
@content = tran_base64_decode64(file_content)
|
||||
if @content.nil?
|
||||
raise("示例代码为空,代码重置失败")
|
||||
# @entries = @repository.entries(@path, @rev)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
class KuberneteController < ApplicationController
|
||||
require 'open3'
|
||||
layout "base_edu"
|
||||
|
||||
RC_PATH = "files/k8s/webssh/controller.yaml"
|
||||
SVC_PATH = "files/k8s/webssh/service.yaml"
|
||||
SERVER_URL = "https://106.75.96.108:6443"
|
||||
TOKEN = "c7dd73a7c86992fb"
|
||||
# YAML.load(File.open(rc_PATH))
|
||||
# REDO:销毁的时候文件一并要销毁
|
||||
def exec_pod
|
||||
# 生成ymal文件
|
||||
nod_name = params[:name]
|
||||
path_type = params[:type]
|
||||
rc = YAML.load(File.open(RC_PATH))
|
||||
svc = YAML.load(File.open(SVC_PATH))
|
||||
File.new(File.join("files/k8s/#{path_type}", "controller-#{nod_name}.yaml"),"w+")
|
||||
File.new(File.join("files/k8s/#{path_type}", "service-#{nod_name}.yaml"),"w+")
|
||||
rc = change_yaml_info(rc, nod_name, "rc")
|
||||
svc = change_yaml_info(svc, nod_name, "svc")
|
||||
current_rc_path = "files/k8s/#{path_type}/controller-#{nod_name}.yaml"
|
||||
current_svc_path = "files/k8s/#{path_type}/service-#{nod_name}.yaml"
|
||||
open(current_rc_path, 'w') { |f| YAML.dump(rc, f) }
|
||||
open(current_svc_path, 'w') { |f| YAML.dump(svc, f) }
|
||||
# 启动容器
|
||||
# 删除容器命令
|
||||
# 如果连接到其它服务器可以使用ssh -t
|
||||
kubenete_rc = "kubectl --server='" + SERVER_URL + "' --token='" + TOKEN + "' --insecure-skip-tls-verify=true " + "create -f " + current_rc_path
|
||||
kubenete_svc = "kubectl --server='" + SERVER_URL + "' --token='" + TOKEN + "' --insecure-skip-tls-verify=true " + "create -f " + current_svc_path
|
||||
logger.info("webss kubenete_rc is" + kubenete_rc)
|
||||
logger.info("webss kubenete_svc is" + kubenete_svc)
|
||||
# stdin, stdout, stderr, wait_thr = Open3.popen3([env,] cmd... [, opts])
|
||||
# 可以多少秒以后执行
|
||||
stdin, stdout, stderr = Open3.popen3(kubenete_rc)
|
||||
logger.info("Open3 result is ###"+ stdout.gets)
|
||||
stdin2, stdout2, stderr2 = Open3.popen3(kubenete_svc)
|
||||
logger.info("Open3 result is ###"+ stdout2.gets)
|
||||
render :json => {:status => "good"}
|
||||
end
|
||||
|
||||
def exec_container
|
||||
pod_name = "webssh-master#{parmas[:myshixun_id]}"
|
||||
git_url =
|
||||
# kubectl exec webssh-master1-gn1ww -c webssh python -v
|
||||
# webssh 容器中执行命令,克隆代码,注意代码存放位置
|
||||
git_clone = "kubectl --server='#{SERVER_URL}' --token='#{TOKEN}' --insecure-skip-tls-verify=true exec webssh-master1-gn1ww -c webssh clone #{git_url}"
|
||||
stdin, stdout, stderr = Open3.popen3(git_clone)
|
||||
format.js
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# yaml数据处理
|
||||
# 处理数据类型如下
|
||||
def change_yaml_info rc, nod_name, type
|
||||
rc['metadata']['name'] = rc['metadata']['name'] + nod_name
|
||||
rc['metadata']['labels']['name'] = rc['metadata']['labels']['name'] + nod_name
|
||||
rc['spec']['selector']['name'] = rc['spec']['selector']['name'] + nod_name
|
||||
if type == "rc"
|
||||
rc['spec']['template']['metadata']['labels']['name'] = rc['spec']['template']['metadata']['labels']['name'] + nod_name
|
||||
elsif type == "svc"
|
||||
rc['spec']['ports'][0]['nodePort'] = rc['spec']['ports'][0]['nodePort'].to_i + nod_name.to_i
|
||||
end
|
||||
return rc
|
||||
end
|
||||
end
|
||||
|
|
@ -9,47 +9,80 @@ class ManagementsController < ApplicationController
|
|||
# 专业列表
|
||||
def profession
|
||||
@syllabus=Syllabus.where("0=0")
|
||||
@menu_type=11
|
||||
@sub_type=1
|
||||
major_level_option=params[:major_level_option]
|
||||
discipline_category_option=params[:discipline_category_option]
|
||||
first_level_discipline_option=params[:first_level_discipline_option]
|
||||
if major_level_option!='0'
|
||||
@syllabus=@syllabus.where(:major_level=>major_level_option)
|
||||
else
|
||||
@syllabus=@syllabus
|
||||
@menu_type = 12
|
||||
@sub_type = 1
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
major_level_option = params[:major_level] if params[:major_level]
|
||||
discipline_category_option = params[:discipline_category_id] if params[:discipline_category_id]
|
||||
first_level_discipline_option = params[:first_level_discipline_id] if params[:first_level_discipline_id]
|
||||
if major_level_option && major_level_option != '0'
|
||||
@syllabus = @syllabus.where(:major_level=>major_level_option)
|
||||
end
|
||||
|
||||
if discipline_category_option !=nil
|
||||
if discipline_category_option && discipline_category_option != '0'
|
||||
@syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
|
||||
end
|
||||
|
||||
if first_level_discipline_option!=nil
|
||||
if first_level_discipline_option && first_level_discipline_option != '0'
|
||||
@syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
|
||||
end
|
||||
@syllabus = @syllabus.order("created_at #{@sx_order}")
|
||||
@syllabus_count = @syllabus.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
@syllabus_pages = Paginator.new @syllabus_count, limit, params['page'] || 1
|
||||
@offset ||= @syllabus_pages.offset
|
||||
@syllabus = paginateHelper @syllabus, limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# 实训适用课程
|
||||
def applicable_course
|
||||
@majorcourse=MajorCourse.where("0=0")
|
||||
@menu_type = 12
|
||||
@sub_type = 2
|
||||
@major = Major.where(:major_level => 2)
|
||||
@courselist = CourseList.where("0=0")
|
||||
search=params[:search]
|
||||
unless search.blank?
|
||||
@courselist = @courselist.where("name like '%#{search}%'")
|
||||
end
|
||||
@courselist = @courselist.reorder("created_at desc")
|
||||
@courselist_count = @courselist.count
|
||||
@limit = 4
|
||||
@is_remote = true
|
||||
@page = params['page'] ? params['page'].to_i : 1
|
||||
@courselist_pages = Paginator.new @courselist_count, @limit, @page
|
||||
@offset ||=@courselist_pages.offset
|
||||
@courselist = paginateHelper @courselist, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
# 增加课程
|
||||
def add_course
|
||||
courselist= CourseList.create(:name => params[:course])
|
||||
redirect_to applicable_course_managements_path
|
||||
end
|
||||
|
||||
# 增加课程所属专业
|
||||
def add_major
|
||||
data = {result: 0}
|
||||
id = MajorCourse.where(:course_list_id => params[:course_list_id]).first
|
||||
if (id.nil?) || (params[:major_id].to_i != '0' && params[:major_id].to_i != id.major_id)
|
||||
MajorCourse.create(:course_list_id => params[:course_list_id],:major_id=>params[:major_id])
|
||||
data[:result] = 1
|
||||
end
|
||||
render :json => data
|
||||
end
|
||||
|
||||
# 单位部门列表
|
||||
def departments
|
||||
@menu_type = 6
|
||||
@sub_type = 2
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
@department =Department.where("0=0")
|
||||
search=params[:search]
|
||||
if search.blank?
|
||||
|
|
@ -57,6 +90,7 @@ class ManagementsController < ApplicationController
|
|||
else
|
||||
@department = @department.where("name like '%#{search}%'")
|
||||
end
|
||||
@department = @department.reorder("created_at #{@sx_order}")
|
||||
@department_count =@department.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
|
|
@ -67,26 +101,27 @@ class ManagementsController < ApplicationController
|
|||
format.js
|
||||
format.html
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# 单位列表
|
||||
def departments_part
|
||||
@menu_type = 6
|
||||
@sub_type = 1
|
||||
@schools = School.where("0=0")
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
search=params[:search]
|
||||
if search.blank?
|
||||
@schools = @schools
|
||||
else
|
||||
@schools = @schools.where("name like '%#{search}%'")
|
||||
end
|
||||
@schools = @schools.reorder("created_at #{@sx_order}")
|
||||
@schools_count = @schools.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
@schools_pages = Paginator.new @schools_count, limit, params['page'] || 1
|
||||
@offset ||= @schools_pages.offset
|
||||
@schools= paginateHelper @schools, limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
|
@ -98,12 +133,14 @@ class ManagementsController < ApplicationController
|
|||
@menu_type = 10
|
||||
@sub_type = 3
|
||||
search = params[:search]
|
||||
@apply_status = ApplyAddDepartment.where("0=0")
|
||||
@apply_status = ApplyAddDepartment.where(:status=>0)
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
if search.blank?
|
||||
@apply_status = @apply_status.where("0=0")
|
||||
else
|
||||
@apply_status= @apply_status.where("name like '%#{search}%'")
|
||||
end
|
||||
@apply_status = @apply_status.order("created_at #{@sx_order}")
|
||||
@apply_status_count = @apply_status.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
|
|
@ -116,70 +153,230 @@ class ManagementsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 批准
|
||||
def approve_applied_departments
|
||||
applied_department = ApplyAddDepartment.find params[:id]
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
|
||||
applied_message.update_all(:status => 1)
|
||||
applied_department.update_column('status', 1) unless applied_department.nil?
|
||||
AppliedMessage.create(:user_id => applied_department.user_id, :status => 1, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to depart_managements_path }
|
||||
end
|
||||
end
|
||||
|
||||
# 删除
|
||||
def delete_applied_departments
|
||||
applied_department = ApplyAddDepartment.find params[:id]
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
|
||||
applied_message.update_all(:status => 3)
|
||||
applied_department.update_attribute(:status, 3)
|
||||
# 未审批删除
|
||||
if params[:tip] == "unapplied"
|
||||
AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("department_id = #{applied_department.department_id}")
|
||||
users.update_all(:department_id => nil)
|
||||
applied_department.department.destroy
|
||||
redirect_to depart_managements_path
|
||||
# 已审批删除
|
||||
elsif params[:tip] == "applied"
|
||||
applied_department.destroy
|
||||
redirect_to depart_managements_path
|
||||
end
|
||||
end
|
||||
|
||||
# 部门修改
|
||||
def all_department
|
||||
apply_department = ApplyAddDepartment.where("status = 0")
|
||||
apply_department_ids = apply_department.empty? ? "(-1)" : "(" + apply_department.map{|sc| sc.department_id}.join(',') + ")"
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@department = Department.where("id not in #{apply_department_ids} and #{Department.table_name}.name like :p", :p => search)
|
||||
#@schools = School.all
|
||||
else
|
||||
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
@department = Department.where("id not in #{apply_department_ids}")
|
||||
end
|
||||
@edit_id = params[:department_id]
|
||||
@search = params[:search]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
# redirect_to unit_managements_path
|
||||
end
|
||||
# 修改
|
||||
def edit_applied_department
|
||||
aas =ApplyAddDepartment.find(params[:applied_id])
|
||||
# aas.update_attribute(:name, params[:name])
|
||||
#applied_add_school = ApplyAddSchools.where(:name => aas.name)
|
||||
department =Department.find params[:department_id]
|
||||
begin
|
||||
#更新消息表的status
|
||||
applied_message_id = aas.department_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddDepartment")
|
||||
applied_message.update_all(:status => 4)
|
||||
aas.update_attribute(:status, 2)
|
||||
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddDepartment", :name =>department[0].name )
|
||||
users = UserExtensions.where("department_id = #{aas.department_id}")
|
||||
users.update_all(:department_id => department.id)
|
||||
if aas.department_id != department.id.to_i
|
||||
aas.department.destroy
|
||||
end
|
||||
ApplyAddDepartment.where(:department_id => aas.department_id).update_all(:department_id => department.id)
|
||||
Department.where(:department_id => aas.department_id).update_all(:department_id => department.id)
|
||||
aas.update_attribute(:department_id, department.id)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
redirect_to depart_managements_path
|
||||
end
|
||||
|
||||
# 单位审批
|
||||
def unit
|
||||
@menu_type = 10
|
||||
@sub_type = 4
|
||||
search = params[:search]
|
||||
@apply_status = ApplyAddSchools.where("0=0")
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
@apply_status = ApplyAddSchools.where(:status=>0)
|
||||
if search.blank?
|
||||
@apply_status = @apply_status.where("0=0")
|
||||
else
|
||||
@apply_status= @apply_status.where("name like '%#{search}%'")
|
||||
end
|
||||
@apply_status = @apply_status.order("created_at #{@sx_order}")
|
||||
@apply_status_count = @apply_status.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
@apply_status_pages = Paginator.new @apply_status_count, limit, params['page'] || 1
|
||||
@offset ||= @apply_status_pages.offset
|
||||
@apply_status = paginateHelper @apply_status, limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
# 单位审批批准
|
||||
def approve_applied_schools
|
||||
applied_school = ApplyAddSchools.where(:id =>params[:id]).first
|
||||
applied_message_id = applied_school.school_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
|
||||
applied_message.update_all(:status => 1)
|
||||
unless applied_school.nil?
|
||||
applied_school.update_column('status', 1)
|
||||
end
|
||||
school = applied_school.school
|
||||
school.update_attribute("province", applied_school.province)
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
redirect_to unit_managements_path
|
||||
end
|
||||
|
||||
# 删除
|
||||
def delete_applied_schools
|
||||
applied_school = ApplyAddSchools.find(params[:id])
|
||||
applied_message_id = applied_school.school_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
|
||||
applied_message.update_all(:status => 3)
|
||||
applied_school.update_attribute(:status, 3)
|
||||
# 单位对应的部门审核也应做删除处理
|
||||
applied_departments = ApplyAddDepartment.where(:school_id => applied_school.school_id)
|
||||
applied_departments.update_all(:status => 3)
|
||||
AppliedMessage.where(:applied_id => applied_departments.map(&:id), :applied_type => "ApplyAddDepartment").update_all(:status => 3)
|
||||
# 未审批删除
|
||||
if params[:tip] == "unapplied"
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
if applied_departments.first
|
||||
AppliedMessage.create(:user_id => applied_departments.first.user_id, :status => 3, :viewed => 0, :applied_id => applied_departments.first.id, :applied_type => "ApplyAddDepartment", :name => applied_departments.first.name )
|
||||
end
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.update_all(:school_id => nil, :department_id => nil)
|
||||
applied_school.school.destroy
|
||||
applied_school.school.departments.destroy_all
|
||||
redirect_to unit_managements_path
|
||||
# 已审批删除
|
||||
elsif params[:tip] == "applied"
|
||||
applied_school.destroy
|
||||
redirect_to unit_managements_path
|
||||
end
|
||||
end
|
||||
|
||||
# 单位审批修改
|
||||
def all_schools
|
||||
apply_schools = ApplyAddSchools.where("status = 0")
|
||||
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search)
|
||||
#@schools = School.all
|
||||
else
|
||||
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
@schools = School.where("id not in #{apply_school_ids}")
|
||||
end
|
||||
@edit_id = params[:school_id]
|
||||
@search = params[:search]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 修改
|
||||
def edit_applied_schools
|
||||
aas = ApplyAddSchools.find(params[:applied_id])
|
||||
school = School.find params[:school_id]
|
||||
begin
|
||||
#更新消息表的status
|
||||
applied_message_id = aas.school_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
|
||||
applied_message.update_all(:status => 4)
|
||||
aas.update_attribute(:status, 2)
|
||||
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
|
||||
users = UserExtensions.where("school_id = #{aas.school_id}")
|
||||
users.update_all(:school_id => school.id)
|
||||
if aas.school_id != school.id.to_i
|
||||
aas.school.destroy
|
||||
end
|
||||
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id)
|
||||
Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
|
||||
aas.update_attribute(:school_id, school.id)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
redirect_to unit_managements_path
|
||||
end
|
||||
|
||||
# 课堂列表
|
||||
def classroom
|
||||
@menu_type = 2
|
||||
@sub_type = 1
|
||||
@syllabus = Syllabus.where("0=0")
|
||||
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
|
||||
user_exs=UserExtensions.where(:user_id=> @syllabus.map(&:user_id))
|
||||
@schools = School.where(:id =>user_exs.map(&:school_id))
|
||||
major_level_option = params[:major_level] if params[:major_level]
|
||||
discipline_category_option = params[:discipline_category_id] if params[:discipline_category_id]
|
||||
first_level_discipline_option = params[:first_level_discipline_id] if params[:first_level_discipline_id]
|
||||
syllabus_major_option = params[:major_id] if params[:major_id]
|
||||
keyword = params[:keyword]
|
||||
search = params[:search]
|
||||
|
||||
if major_level_option && major_level_option != '0'
|
||||
@syllabus = @syllabus.where(:major_level=>major_level_option)
|
||||
end
|
||||
|
||||
major_level_option=params[:major_level_option]
|
||||
discipline_category_option=params[:discipline_category_option]
|
||||
first_level_discipline_option=params[:first_level_discipline_option]
|
||||
syllabus_major_option=params[:syllabus_major_option]
|
||||
keyword=params[:keyword]
|
||||
search=params[:search]
|
||||
if major_level_option!='0'
|
||||
@syllabus=@syllabus.where(:major_level=>major_level_option)
|
||||
else
|
||||
@syllabus=@syllabus
|
||||
end
|
||||
|
||||
if discipline_category_option !=nil
|
||||
if discipline_category_option && discipline_category_option != '0'
|
||||
@syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
|
||||
end
|
||||
|
||||
if first_level_discipline_option!=nil
|
||||
if first_level_discipline_option && first_level_discipline_option != '0'
|
||||
@syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
|
||||
end
|
||||
|
||||
if syllabus_major_option!=nil
|
||||
if syllabus_major_option && syllabus_major_option != '0'
|
||||
@syllabus=@syllabus.where(:major_id=>syllabus_major_option)
|
||||
end
|
||||
|
||||
if params[:school_id] && params[:school_id] != '0'
|
||||
@syllabus = Syllabus.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
|
||||
else
|
||||
@syllabus = @syllabus.where("0=0")
|
||||
if params[:school_id] && params[:school_id] != ''
|
||||
@syllabus = @syllabus.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
|
||||
end
|
||||
|
||||
if search.blank?
|
||||
|
|
@ -189,18 +386,20 @@ class ManagementsController < ApplicationController
|
|||
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
@syllabus = @syllabus.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
|
||||
else
|
||||
@syllabus= @syllabus.where("user_id like '%#{search}%'")
|
||||
@syllabus= @syllabus.where("title like '%#{search}%'")
|
||||
end
|
||||
end
|
||||
@syllabus_count = @syllabus.count
|
||||
|
||||
@syllabus = @syllabus.order("syllabuses.created_at #{@sx_order}")
|
||||
@syllabus_count = @syllabus.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
@syllabus_pages = Paginator.new @syllabus_count, limit, params['page'] || 1
|
||||
@offset ||= @syllabus_pages.offset
|
||||
@syllabus = paginateHelper @syllabus, limit
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -210,35 +409,40 @@ class ManagementsController < ApplicationController
|
|||
@sub_type = 2
|
||||
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
|
||||
@courses = Course.where("0=0")
|
||||
# @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
|
||||
@timing=Course.where(:is_end=>false).count
|
||||
@end=Course.where(:is_end=>true).count
|
||||
unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
|
||||
user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id))
|
||||
@schools = School.where(:id =>user_exs.map(&:school_id))
|
||||
end
|
||||
search = params[:search] # 搜索字
|
||||
keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
|
||||
@search = params[:search] # 搜索字
|
||||
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
|
||||
status = params[:status].to_i
|
||||
if params[:school_id] && params[:school_id] != '0'
|
||||
@courses =Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}").order("created_at #{@sx_order}")
|
||||
else
|
||||
@courses = Course.where("0=0").order("created_at #{@sx_order}")
|
||||
|
||||
if params[:school_id] && params[:school_id] != ''
|
||||
@school_id = params[:school_id]
|
||||
@courses =Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
|
||||
end
|
||||
|
||||
if params[:homepage_show]
|
||||
@courses = @courses.where(:homepage_show => params[:homepage_show].to_i)
|
||||
end
|
||||
|
||||
if params[:status] && params[:status]!=''
|
||||
@courses =@courses.where(:is_end =>status).order("created_at #{@sx_order}")
|
||||
@status = params[:status]
|
||||
@courses =@courses.where(:is_end =>status)
|
||||
end
|
||||
if "u_name" == keyword
|
||||
if search.blank?
|
||||
@courses = @courses.order("created_at #{@sx_order}")
|
||||
if "u_name" == @keyword
|
||||
if @search.blank?
|
||||
@courses = @courses
|
||||
else
|
||||
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
@courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'").order("created_at #{@sx_order}")
|
||||
user_id = User.where("concat(lastname, firstname) like '%#{@search}%'")
|
||||
@courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'")
|
||||
end
|
||||
else
|
||||
@courses= @courses.where("name like '%#{search}%'").order("created_at #{@sx_order}")
|
||||
@courses= @courses.where("name like '%#{@search}%'")
|
||||
end
|
||||
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime desc")
|
||||
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}")
|
||||
@courses_count = @courses.count
|
||||
limit = 20
|
||||
@is_remote = true
|
||||
|
|
@ -251,6 +455,14 @@ class ManagementsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 班级首页显示
|
||||
def course_homepage_show
|
||||
if params[:course_id]
|
||||
course = Course.find params[:course_id]
|
||||
course.update_attributes(:homepage_show => !course.homepage_show)
|
||||
end
|
||||
end
|
||||
|
||||
# 课程实训
|
||||
def class_shixuns
|
||||
@menu_type = 4
|
||||
|
|
@ -273,13 +485,12 @@ class ManagementsController < ApplicationController
|
|||
@c_shixuns = @c_shixuns
|
||||
else
|
||||
if "u_name" == keyword
|
||||
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
# user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
@c_shixuns = @c_shixuns.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
|
||||
else
|
||||
@c_shixuns= @c_shixuns.where("name like '%#{search}%'")
|
||||
end
|
||||
end
|
||||
@c_shixuns = @c_shixuns.reorder("created_at desc")
|
||||
unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
|
||||
user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id))
|
||||
@schools = School.where(:id => user_exs.map(&:school_id))
|
||||
|
|
@ -290,6 +501,11 @@ class ManagementsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_subject_hidden
|
||||
@subject = Subject.find(params[:subject_id])
|
||||
@subject.update_column(:hidden, !@subject.hidden)
|
||||
end
|
||||
|
||||
# 已发布课程实训
|
||||
def class_publish_shixuns
|
||||
@menu_type = 4
|
||||
|
|
@ -302,20 +518,19 @@ class ManagementsController < ApplicationController
|
|||
@c_shixuns = Subject.where(:status => 2)
|
||||
end
|
||||
if search.blank?
|
||||
@c_shixuns = @c_shixuns
|
||||
else
|
||||
if "u_name" == keyword
|
||||
|
||||
elsif "u_name" == keyword
|
||||
# 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user
|
||||
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
|
||||
@c_shixuns = @c_shixuns.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
|
||||
else
|
||||
@c_shixuns= @c_shixuns.where("name like '%#{search}%'")
|
||||
end
|
||||
end
|
||||
unless params[:school_id] || params[:search] || params[:keyword]
|
||||
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")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
|
@ -388,6 +603,11 @@ class ManagementsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_shixun_hidden
|
||||
@shixun = Shixun.find(params[:shixun_id])
|
||||
@shixun.update_column(:hidden, !@shixun.hidden)
|
||||
end
|
||||
|
||||
# 已发布的实训
|
||||
def publish_shixuns
|
||||
@menu_type = 3
|
||||
|
|
@ -410,6 +630,9 @@ class ManagementsController < ApplicationController
|
|||
else
|
||||
@shixuns = Shixun.where("name like '%#{search}%'").where(:status => 2).order("created_at #{@sx_order}")
|
||||
end
|
||||
if params[:homepage_show]
|
||||
@shixuns = @shixuns.where(:homepage_show => params[:homepage_show].to_i)
|
||||
end
|
||||
@shixuns_count = @shixuns.count
|
||||
limit = 20
|
||||
@shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1
|
||||
|
|
@ -420,6 +643,13 @@ class ManagementsController < ApplicationController
|
|||
format.html
|
||||
end
|
||||
end
|
||||
# 实训首页显示
|
||||
def shixun_homepage_show
|
||||
if params[:shixun_id]
|
||||
shixun = Shixun.find params[:shixun_id]
|
||||
shixun.update_attributes(:homepage_show => !shixun.homepage_show)
|
||||
end
|
||||
end
|
||||
|
||||
# 已关闭的实训
|
||||
def close_shixuns
|
||||
|
|
@ -693,7 +923,7 @@ class ManagementsController < ApplicationController
|
|||
|
||||
def subject_authorization
|
||||
@menu_type = 10
|
||||
@sub_type == 6
|
||||
@sub_type = 6
|
||||
@type = trial_authorization_status params[:type]
|
||||
@authorizations = ApplyAction.where(:container_type => "ApplySubject", :status => @type).order("created_at desc")
|
||||
# @subject=Subject.all
|
||||
|
|
@ -712,7 +942,7 @@ class ManagementsController < ApplicationController
|
|||
|
||||
def shixun_authorization
|
||||
@menu_type = 10
|
||||
@sub_type == 5
|
||||
@sub_type = 5
|
||||
@type = trial_authorization_status params[:type]
|
||||
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
|
||||
search = params[:search]
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ class MyshixunsController < ApplicationController
|
|||
username = Redmine::Configuration['webssh_username']
|
||||
password = Redmine::Configuration['webssh_password']
|
||||
begin
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/webssh/getConnectInfo")
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
uri = "#{shixun_tomcat}/bridge/webssh/getConnectInfo"
|
||||
user_id = User.current.id
|
||||
params = {gameID:@myshixun.id, operationEnvironment:@myshixun.shixun.try(:language)}
|
||||
params = {tpiID:@myshixun.id, operationEnvironment:@myshixun.shixun.try(:language)}
|
||||
res = uri_exec uri, params
|
||||
if res && res['code'].to_i != 0
|
||||
raise("实训云平台繁忙(繁忙等级:92)")
|
||||
|
|
@ -45,12 +45,12 @@ class MyshixunsController < ApplicationController
|
|||
username = Redmine::Configuration['webssh_username']
|
||||
password = Redmine::Configuration['webssh_password']
|
||||
begin
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/webssh/deleteSSH")
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
uri = "#{shixun_tomcat}/bridge/webssh/deleteSSH"
|
||||
user_id = User.current.id
|
||||
logger.info("#############################")
|
||||
logger.info("game_id:" + @_params[:id])
|
||||
params = {gameID:@_params[:id]} # @_params[:id] 是webssh传过来的gameId
|
||||
params = {tpiID:@_params[:id]} # @_params[:id] 是webssh传过来的gameId
|
||||
res = uri_exec uri, params
|
||||
if res && res['code'].to_i != 0
|
||||
raise("实训云平台繁忙(繁忙等级:93)")
|
||||
|
|
@ -67,9 +67,9 @@ class MyshixunsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
g = Gitlab.client
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
shixun = @myshixun.shixun
|
||||
myshixun_job = Base64.encode64("myshixun_#{@myshixun.id}")
|
||||
myshixun_job = Base64.urlsafe_encode64("myshixun_#{@myshixun.id}")
|
||||
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => nil, :work_status => 0)
|
||||
@myshixun.destroy
|
||||
myshixun_member = @myshixun
|
||||
|
|
@ -83,13 +83,6 @@ class MyshixunsController < ApplicationController
|
|||
raise("实训云平台繁忙(繁忙等级:87)")
|
||||
end
|
||||
end
|
||||
# job的删除放异步里面处理
|
||||
# params = {:jobName => "#{myshixun_job}"}
|
||||
# uri = URI("#{jenkins_shixuns}/jenkins-exec/game/deleteJob")
|
||||
# res = uri_exec uri, params
|
||||
# if res && res['code'].to_i != 0 && res['code'].to_i != 1
|
||||
# raise("实训云平台繁忙(繁忙等级:89)")
|
||||
# end
|
||||
redirect_to shixun_exec_shixun_path(shixun, :type => 1)
|
||||
rescue Exception => e
|
||||
flash[:error] = "实训云平台繁忙(繁忙等级:89)"
|
||||
|
|
@ -114,22 +107,26 @@ class MyshixunsController < ApplicationController
|
|||
status = jsonTestDetails['status']
|
||||
game_id = jsonTestDetails['buildID']
|
||||
resubmit = jsonTestDetails['resubmit']
|
||||
outPut = Base64.urlsafe_decode64(jsonTestDetails['outPut'].strip().gsub(" ", "+")).force_encoding("utf-8") unless jsonTestDetails['outPut'].blank?
|
||||
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
|
||||
jenkins_testsets = jsonTestDetails['msg']
|
||||
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||
logger.info(outPut)
|
||||
game = Game.find(game_id)
|
||||
challenge = game.challenge
|
||||
unless jenkins_testsets.blank?
|
||||
jenkins_testsets.each do |j_test_set|
|
||||
actual_output = Base64.urlsafe_decode64(j_test_set['output'].gsub(" ", "+")).force_encoding("utf-8") unless j_test_set['output'].blank?
|
||||
output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first
|
||||
logger.info("#############{outPut}")
|
||||
if output.nil?
|
||||
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
|
||||
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :is_public => j_test_set['isPublic'].to_i)
|
||||
else
|
||||
output.update_attributes(:code => status, :out_put => outPut, :actual_output => actual_output, :result => j_test_set['passed'].to_i)
|
||||
end
|
||||
actual_output = tran_base64_decode64(j_test_set['output'])
|
||||
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
|
||||
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index)
|
||||
|
||||
# output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first
|
||||
# logger.info("#############{outPut}")
|
||||
# if output.nil?
|
||||
# game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
|
||||
# :actual_output => actual_output, :result => j_test_set['passed'].to_i)
|
||||
# else
|
||||
# output.update_attributes(:code => status, :out_put => outPut, :actual_output => actual_output, :result => j_test_set['passed'].to_i)
|
||||
# end
|
||||
end
|
||||
end
|
||||
if status == "0"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,56 @@ class ShixunsController < ApplicationController
|
|||
layout 'base_shixun'
|
||||
before_filter :require_login
|
||||
before_filter :check_authentication
|
||||
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss]
|
||||
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate]
|
||||
before_filter :shixun_view_allow, :only => [:show]
|
||||
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators]
|
||||
before_filter :validation_email, :only => [:new]
|
||||
#skip_before_filter :verify_authenticity_token, :only => :update_propaedeutics
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
def shixun_migrate
|
||||
unless User.current.admin?
|
||||
render_403
|
||||
return
|
||||
end
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
if params[:shixun_id]
|
||||
shixuns = Shixun.where(:id => params[:shixun_id])
|
||||
else
|
||||
shixuns = Shixun.all
|
||||
end
|
||||
shixuns.each do |shixun|
|
||||
begin
|
||||
logger.info("shixun id is #{shixun.id}")
|
||||
tpiList =[]
|
||||
gameInfo = shixun.gameInfo
|
||||
myshixuns = shixun.myshixuns
|
||||
if myshixuns.present?
|
||||
myshixuns.each do |myshixun|
|
||||
logger.info("tpiID is #{myshixun.id}")
|
||||
tpiID = myshixun.id
|
||||
instanceGitURL = git_myshixun_url_ip(myshixun, myshixun.try(:user_id))
|
||||
logger.info("instanceGitURL is #{instanceGitURL}")
|
||||
tpiList << {:tpiID => tpiID, :instanceGitURL => instanceGitURL}
|
||||
logger.info("###############{tpiList.to_json unless tpiList.blank?}")
|
||||
|
||||
logger.info("************#{tpiList}")
|
||||
end
|
||||
end
|
||||
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
|
||||
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
|
||||
logger.info("params is #{params}")
|
||||
uri = "#{shixun_tomcat}/bridge/dataTransfer/transfer"
|
||||
logger.info("uri is #{uri}")
|
||||
res = uri_exec uri, params
|
||||
logger.info("=====res is #{res['code']}")
|
||||
rescue Exception => e
|
||||
logger.info("error ====> #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def shixun_test
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/webssh/getConnectInfo")
|
||||
|
|
@ -38,7 +81,8 @@ class ShixunsController < ApplicationController
|
|||
@path = params[:path]
|
||||
@rev = params[:rev]
|
||||
file_content = g.files(@shixun.gpid, @path, @rev).content
|
||||
@content = Base64.decode64(file_content) unless file_content.blank?
|
||||
@content = tran_base64_decode64(file_content)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -78,14 +122,16 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@order = "created_at"
|
||||
@sort = "desc"
|
||||
@order = "myshixun_count"
|
||||
@sort = "asc"
|
||||
search = params[:search]
|
||||
@mail = User.current.mail.blank?
|
||||
@shixun_all_count = Shixun.all.count
|
||||
#@shixuns = Shixun.find_by_sql("select * from shixuns where id in (SELECT distinct(shixun_id) FROM `challenges`) and name like '%#{search}%' order by created_at desc")
|
||||
@shixuns = Shixun.where("name like ?", "%#{search}%").reorder("updated_at desc")
|
||||
# @shixun_my_score = Game.find_by_sql("select sum(final_score) as score from games where myshixun_id in (select id from myshixuns where status =1
|
||||
# and user_id=#{User.current.id} and shixun_id in (SELECT id FROM `shixuns` where status > 1))").first.try(:score).to_i
|
||||
@shixuns = Shixun.where("name like ? and hidden = 0", "%#{search}%").reorder("created_at desc")
|
||||
@shixuns.each do |shixun|
|
||||
shixun[:myshixunCount] = shixun.myshixuns.count
|
||||
end
|
||||
@shixuns = @shixuns.sort{|x, y| y[:myshixunCount] <=> x[:myshixunCount]}
|
||||
@shixun_my_score = Experience.find_by_sql("SELECT sum(score) as score FROM `experiences` where user_id=#{User.current.id}").first.try(:score).to_i
|
||||
@current_user_had_passed = Myshixun.find_by_sql("select count(*) as had_passed from myshixuns where status =1 and user_id=#{User.current.id}
|
||||
and shixun_id in (SELECT id FROM `shixuns` where status > 1)").first.try(:had_passed).to_i
|
||||
|
|
@ -118,8 +164,13 @@ class ShixunsController < ApplicationController
|
|||
|
||||
def collaborators_delete
|
||||
user_id = params[:c_id]
|
||||
gid = User.find(user_id).try(:gid)
|
||||
shixun_member = ShixunMember.where(:user_id => user_id, :shixun_id => @shixun.id, :role => 2).first
|
||||
shixun_member.delete
|
||||
g = Gitlab.client
|
||||
unless gid.nil?
|
||||
g.remove_team_member(@shixun.gpid, gid)
|
||||
end
|
||||
@collaborators = @shixun.collaborators
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
@ -132,33 +183,53 @@ class ShixunsController < ApplicationController
|
|||
# members = searchTeacherAndAssistant @course
|
||||
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
|
||||
condition = "%#{params[:search].strip}%".gsub(" ","")
|
||||
@users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname)) LIKE '#{condition}'").includes(:user_extensions)
|
||||
@users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname, login, mail)) LIKE '#{condition}'").includes(:user_extensions)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 事务处理,保证Trustie与Gitlab数据同步
|
||||
def shixun_members_added
|
||||
unless params[:membership][:user_ids].blank?
|
||||
memberships = params[:membership][:user_ids]
|
||||
memberships.each do |member|
|
||||
ShixunMember.create(:user_id => member, :shixun_id => @shixun.id, :role => 2)
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
unless params[:membership][:user_ids].blank?
|
||||
memberships = params[:membership][:user_ids]
|
||||
memberships.each do |member|
|
||||
user = User.find(member)
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
if user.gid.present?
|
||||
gid = user.gid
|
||||
else
|
||||
guser = s.sync_user(user)
|
||||
gid = guser.id
|
||||
end
|
||||
ShixunMember.create!(:user_id => member, :shixun_id => @shixun.id, :role => 2)
|
||||
u = s.g.add_team_member(@shixun.gpid, gid, 40) # 3代表角色master
|
||||
if u.blank?
|
||||
raise("同步Gitlab数据错误")
|
||||
end
|
||||
end
|
||||
@collaborators = @shixun.collaborators
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
logger.error(e)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
@collaborators = @shixun.collaborators
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
# 确定 sort 1升序 2 降序
|
||||
@order = params[:order] || "updated_at"
|
||||
@order = params[:order] || "myshixun_count"
|
||||
bsort = params[:sort] || "desc"
|
||||
@sort = bsort == "desc" ? "asc" : "desc"
|
||||
if @order == "created_at"
|
||||
order_str = "#{Shixun.table_name}.created_at #{bsort}"
|
||||
if @order == "updated_at"
|
||||
order_str = "#{Shixun.table_name}.updated_at #{bsort}"
|
||||
else
|
||||
order_str = "myshixun_count #{bsort}, #{Shixun.table_name}.updated_at #{bsort}"
|
||||
end
|
||||
|
|
@ -170,7 +241,7 @@ class ShixunsController < ApplicationController
|
|||
@course = params[:course]
|
||||
@trainee = params[:trainee]
|
||||
#ids = Shixun.find_by_sql("select group_concat(id) as allId from shixuns where id in (SELECT distinct(shixun_id) FROM `challenges`)")
|
||||
@shixuns = Shixun.where("0=0")
|
||||
@shixuns = Shixun.where("hidden = 0")
|
||||
@shixuns = @shixuns.where(:language => @language) unless @language.blank?
|
||||
@shixuns = @shixuns.where("name like ?", "%#{@search}%") unless @search.blank?
|
||||
if !@major.blank?
|
||||
|
|
@ -211,14 +282,18 @@ class ShixunsController < ApplicationController
|
|||
when nil, "0"
|
||||
@shixuns = @shixuns
|
||||
end
|
||||
if @order == "created_at"
|
||||
if @order == "updated_at"
|
||||
@shixuns =@shixuns.reorder(order_str)
|
||||
else
|
||||
# 最热排序
|
||||
@shixuns.each do |shixun|
|
||||
shixun[:myshixunCount] = shixun.myshixuns.count
|
||||
end
|
||||
if bsort == "desc"
|
||||
@shixuns = @shixuns.sort{|x, y| y[:myshixunCount] <=> x[:myshixunCount]}
|
||||
else
|
||||
@shixuns = @shixuns.sort{|x, y| x[:myshixunCount] <=> y[:myshixunCount]}
|
||||
end
|
||||
end
|
||||
# @shixuns = Shixun.where(:authentication => 1).reorder(order)
|
||||
@shixuns_count = @shixuns.count
|
||||
|
|
@ -235,31 +310,16 @@ class ShixunsController < ApplicationController
|
|||
# jenkins回调脚本
|
||||
# gameID 及实训ID
|
||||
def publish
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
begin
|
||||
gameInfo = @shixun.gameInfo
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/publishGame")
|
||||
logger.info(gameInfo)
|
||||
params = {gameInfo:gameInfo}
|
||||
logger.info(params)
|
||||
res = uri_exec uri, params
|
||||
logger.info("###################{res['code']}")
|
||||
if res && res['code'].to_i == 0
|
||||
logger.info("1111###################{res['code']}")
|
||||
@shixun.update_attributes(:status => 1)
|
||||
apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first
|
||||
if apply && apply.status == 0
|
||||
@status = 0
|
||||
else
|
||||
ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0)
|
||||
notes = User.current.show_name.to_s + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
|
||||
JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0)
|
||||
@status = 1
|
||||
end
|
||||
shixun_modify_status_without_publish(@shixun, 1)
|
||||
@shixun.update_attributes!(:status => 1)
|
||||
apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first
|
||||
if apply && apply.status == 0
|
||||
@status = 0
|
||||
else
|
||||
logger.error("res['code'] is #{res['code']}, res['msg'] is #{res['code']}")
|
||||
@jenkin_error = true
|
||||
ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0)
|
||||
notes = User.current.show_name.to_s + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
|
||||
JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0)
|
||||
@status = 1
|
||||
end
|
||||
rescue Exception => e
|
||||
@jenkin_error = true
|
||||
|
|
@ -322,14 +382,13 @@ class ShixunsController < ApplicationController
|
|||
gshixun = @g.fork(@shixun.gpid, User.current.gid)
|
||||
logger.info("#############gshixun is #{gshixun}")
|
||||
if !gshixun.id.nil?
|
||||
# 防止fork多次的问题
|
||||
myshixun = copy_myshixun(@shixun, gshixun)
|
||||
# @shixun.update_attribute(:myshixun_count, (@shixun.myshixun_count + 1))
|
||||
challenges = @shixun.challenges
|
||||
# 之所以增加user_id是为了方便统计查询性能
|
||||
challenges.each_with_index do |challenge, index|
|
||||
status = (index == 0 ? 0 : 3)
|
||||
code = CODES.sample(12).join
|
||||
code = CODES.sample(12).join if Game.where(identifier: code).present?
|
||||
code = down_generate_identifier("game")
|
||||
game =Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id, :open_time => Time.now, :identifier => code)
|
||||
# 记录刚开始时默认代开文件原始代码
|
||||
# 刚开始fork的一段时间是获取不了content内容的
|
||||
|
|
@ -343,26 +402,6 @@ class ShixunsController < ApplicationController
|
|||
shixun_mod.update_attributes(:status => 0)
|
||||
end
|
||||
end
|
||||
# webssh类型开始实训的时候建立webssh连接
|
||||
# if @shixun.webssh
|
||||
# # username = Redmine::Configuration['webssh_username']
|
||||
# # password = Redmine::Configuration['webssh_password']
|
||||
# jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
# uri = URI("#{jenkins_shixuns}/jenkins-exec/webssh/getConnectInfo")
|
||||
# user_id = User.current.id
|
||||
# params = {userID:user_id}
|
||||
# res = uri_exec uri, params
|
||||
# if res && res['code'].to_i == 0
|
||||
# myshixun_webssh = Webssh.where(:myshixun_id => myshixun.id).first
|
||||
# if myshixun_webssh.nil?
|
||||
# Webssh.create(:myshixun_id => myshixun.id, :host => @temp, :port => @temp)
|
||||
# else
|
||||
# myshixun_webssh.update_attributes(:host => @temp, :port => @temp)
|
||||
# end
|
||||
# else
|
||||
# raise("实训云平台繁忙(繁忙等级:92)")
|
||||
# end
|
||||
# end
|
||||
else
|
||||
raise("实训云平台繁忙(繁忙等级:81)")
|
||||
end
|
||||
|
|
@ -402,7 +441,6 @@ class ShixunsController < ApplicationController
|
|||
|
||||
def new
|
||||
@shixun = Shixun.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_edu'}
|
||||
format.json
|
||||
|
|
@ -424,8 +462,9 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
|
||||
respond_to do |format|
|
||||
if @shixun.save
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@shixun.save!
|
||||
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
|
||||
@shixun.shixun_members << m
|
||||
# 自动构建版本库
|
||||
|
|
@ -434,25 +473,17 @@ class ShixunsController < ApplicationController
|
|||
repository.type = 'Repository::Gitlab'
|
||||
repository.identifier = @shixun.identifier.downcase
|
||||
repository.project_id = -1
|
||||
ActiveRecord::Base.transaction do
|
||||
if repository.save
|
||||
begin
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
gproject = s.create_shixun(@shixun, repository)
|
||||
raise "sync failed" if @shixun.gpid.blank?
|
||||
rescue Exception => e
|
||||
@shixun.update_attribute(:gpid, nil)
|
||||
if @repository && @repository.id
|
||||
@repository.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
repository.save!
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
gproject = s.create_shixun(@shixun, repository)
|
||||
raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常
|
||||
redirect_to shixun_path @shixun, notice: l(:notice_successful_create)
|
||||
rescue Exception => e
|
||||
respond_to do |format|
|
||||
flash[:notice] = "#{e.message}"
|
||||
redirect_to new_shixun_path
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
format.html { redirect_to shixun_path @shixun, notice: l(:notice_successful_create) }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -470,35 +501,47 @@ class ShixunsController < ApplicationController
|
|||
code
|
||||
end
|
||||
|
||||
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
||||
def down_generate_identifier type
|
||||
if type == "game"
|
||||
code = DCODES.sample(12).join
|
||||
return down_generate_identifier(type) if Game.where(identifier: code).present?
|
||||
elsif type == "myshixun"
|
||||
code = DCODES.sample(10).join
|
||||
return down_generate_identifier(type) if Myshixun.where(identifier: code).present?
|
||||
end
|
||||
code
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
#if @shixun.status == 0
|
||||
language = @shixun.language
|
||||
@shixun.attributes = params[:shixun]
|
||||
@shixun.language = params[:language]
|
||||
@shixun.trainee = params[:trainee]
|
||||
if params[:course_id]
|
||||
@shixun.shixun_major_courses.destroy_all
|
||||
params[:course_id].each do |course_id|
|
||||
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
|
||||
end
|
||||
language = @shixun.language
|
||||
@shixun.attributes = params[:shixun]
|
||||
@shixun.language = params[:language]
|
||||
@shixun.trainee = params[:trainee]
|
||||
if params[:course_id]
|
||||
@shixun.shixun_major_courses.destroy_all
|
||||
params[:course_id].each do |course_id|
|
||||
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
|
||||
end
|
||||
@shixun.major_id = params[:major_id]
|
||||
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
|
||||
if @shixun.save
|
||||
# 实训语言更改了会影响后续的评测,所以需要更新is_updated
|
||||
end
|
||||
@shixun.major_id = params[:major_id]
|
||||
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@shixun.save!
|
||||
if language != params[:language]
|
||||
add_shixun_modify_status(@shixun, 1)
|
||||
shixun_modify_status_without_publish(@shixun, 1)
|
||||
end
|
||||
rescue
|
||||
@error = "实训保存失败"
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
#else
|
||||
# @error = "该实训已申请发布了,暂不能编辑"
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.html{redirect_to settings_shixun_url(@shixun)}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -602,27 +645,30 @@ class ShixunsController < ApplicationController
|
|||
# REDO: 新增类型copy的时候
|
||||
# 复制项目
|
||||
# gshixun --> gitlab project
|
||||
CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
||||
# CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
||||
def copy_myshixun shixun, gshixun
|
||||
myshixun = Myshixun.new
|
||||
myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier","propaedeutics")
|
||||
# myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier","propaedeutics")
|
||||
myshixun.shixun_id = shixun.id
|
||||
myshixun.user_id = User.current.id
|
||||
myshixun.gpid = gshixun.id
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
if myshixun.save!
|
||||
code = CODES.sample(10).join
|
||||
code = CODES.sample(10).join if Myshixun.where(identifier: code).present?
|
||||
# 为了避免fork多次的问题
|
||||
if gshixun.try(:name).include?("-")
|
||||
@g.delete_project(gshixun.id)
|
||||
gshixun = @g.project(myshixun.gpid)
|
||||
myshixun.update_column(:gpid, gshixun.id)
|
||||
end
|
||||
code = down_generate_identifier("myshixun")
|
||||
myshixun.update_attribute(:identifier, code)
|
||||
MyshixunMember.create!(:myshixun_id => myshixun.id, :user_id => User.current.id, :role => 1)
|
||||
rep = Repository.new(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
|
||||
rep.type = "Repository::Gitlab"
|
||||
rep.save!
|
||||
login = User.find_by_mail("educoder@163.com").try(:login)
|
||||
rep_url = Base64.encode64(git_shixun_url_ip shixun, login)
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/openGameInstance")
|
||||
pipeLine = "#{shixun.script}"
|
||||
params = {jobNameForInstance: "myshixun_#{myshixun.id}", gameInfo: shixun.gameInfo, instanceGitURL:rep_url}
|
||||
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip shixun, login)
|
||||
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
|
||||
params = {tpiID: "#{myshixun.id}", tpmID: "#{shixun.id}", instanceGitURL:rep_url, operationEnvironment:"#{shixun.try(:language)}"}
|
||||
logger.info("openGameInstance params is #{params}")
|
||||
res = uri_exec uri, params
|
||||
if (res && res['code'].to_i != 0)
|
||||
|
|
@ -650,4 +696,8 @@ class ShixunsController < ApplicationController
|
|||
render_403 unless (User.current.manager_of_shixun?(@shixun) || User.current.admin?)
|
||||
end
|
||||
|
||||
def validation_email
|
||||
render_403 if User.current.mail.blank?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class SubjectsController < ApplicationController
|
|||
@sort = bsort == "desc" ? "asc" : "desc"
|
||||
search = params[:search]
|
||||
#ids = Subject.find_by_sql("select group_concat(id) as allId from subjects where id in (SELECT distinct(subject_id) FROM `stages`)")
|
||||
@subjects = Subject.where("0=0").reorder("#{@order} #{bsort}")
|
||||
@subjects = Subject.where("hidden = 0").reorder("#{@order} #{bsort}")
|
||||
@subject_created_count = Subject.where(:user_id => User.current.id).count
|
||||
@subjects_all_count = @subjects.count
|
||||
#@subjects = Subject.where("name like ?", "%#{search}%").reorder("#{@order} #{@sort}")
|
||||
|
|
@ -95,7 +95,7 @@ class SubjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def append_to_stage
|
||||
@shixuns = Shixun.where(:id => params[:shixun_id])
|
||||
@shixuns = Shixun.where(:id => params[:choose_ids].split(",")).reorder("id desc")
|
||||
end
|
||||
|
||||
def publish
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class UsersController < ApplicationController
|
|||
:user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community,
|
||||
:shixuns, :user_show_course_list, :shixuns_or_courses_filter, :user_wathlist_and_fanslist]
|
||||
:shixuns, :user_show_course_list, :shixuns_or_courses_filter, :user_wathlist_and_fanslist, :growth_record, :user_grade, :user_experience]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
before_filter :show_system_message, :only => [:show]
|
||||
#before_filter :rest_user_score, only: :show
|
||||
|
|
@ -2277,6 +2277,44 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def growth_record
|
||||
games = @user.games.where(:status => 2)
|
||||
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id))
|
||||
games = @user.games.where(:challenge_id => Challenge.where(:id => challenge_tags.map(&:challenge_id)).map(&:id))
|
||||
@user_tags = @user.experiences.where(:container_id => games.map(&:id)).reorder("created_at desc")
|
||||
#@user_tags = @user.experiences.reorder("created_at desc")
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@tags_count = @user_tags.count
|
||||
@tags_pages = Paginator.new @tags_count, @limit, params['page'] || 1
|
||||
@offset ||= @tags_pages.offset
|
||||
@user_tags = paginateHelper @user_tags, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_edu_user'}
|
||||
end
|
||||
end
|
||||
|
||||
def user_experience
|
||||
@user_experiences = @user.experiences.reorder("created_at desc")
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@experiences_count = @user_experiences.count
|
||||
@experiences_pages = Paginator.new @experiences_count, @limit, params['page'] || 1
|
||||
@offset ||= @experiences_pages.offset
|
||||
@user_experiences = paginateHelper @user_experiences, @limit
|
||||
end
|
||||
|
||||
def user_grade
|
||||
@type = params[:type] ? params[:type].to_i : 1
|
||||
@user_grades = @type == 1 ? @user.grades.where("score > 0").reorder("created_at desc") : @user.grades.where("score < 0").reorder("created_at desc")
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@grades_count = @user_grades.count
|
||||
@grades_pages = Paginator.new @grades_count, @limit, params['page'] || 1
|
||||
@offset ||= @grades_pages.offset
|
||||
@user_grades = paginateHelper @user_grades, @limit
|
||||
end
|
||||
|
||||
def user_show_course_list
|
||||
@courses = @user.courses.not_deleted_not_end.order("updated_at desc")
|
||||
|
|
|
|||
|
|
@ -1,298 +1,298 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class WelcomeController < ApplicationController
|
||||
# layout "base_welcome"
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
helper :project_score
|
||||
caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false
|
||||
#before_filter :find_first_page, :only => [:index]
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
skip_before_filter :check_authentication, :only => [:index]
|
||||
|
||||
def index
|
||||
# @welcome是因为有的页面不需要导航
|
||||
@welcome = true
|
||||
@courses = Course.where(:is_excellent => 1).limit(6)
|
||||
@shixuns = Shixun.where(:authentication => 1).limit(6)
|
||||
render :layout => 'login_bigdata'
|
||||
end
|
||||
|
||||
def robots
|
||||
@projects = Project.all_public.active
|
||||
render :layout => false, :content_type => 'text/plain'
|
||||
end
|
||||
|
||||
def course
|
||||
redirect_to signin_path
|
||||
return
|
||||
#
|
||||
# @course_page = FirstPage.find_by_page_type('course')
|
||||
# @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
|
||||
# @logoLink ||= logolink()
|
||||
end
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.find_by_page_type('course')
|
||||
logo = get_avatar?(@course_page)
|
||||
id = params[:school_id]
|
||||
logo_link = ""
|
||||
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
|
||||
else
|
||||
if id == "0"
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
else
|
||||
if id.nil?
|
||||
if School.find(User.current.user_extensions.school.id).logo_link.nil?
|
||||
logo_link = '/images/transparent.png'
|
||||
else
|
||||
logo_link = School.find(User.current.user_extensions.school.id).logo_link
|
||||
end
|
||||
else
|
||||
logo_link = School.find(id).logo_link
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return logo_link
|
||||
end
|
||||
|
||||
|
||||
def contest
|
||||
redirect_to signin_path
|
||||
return
|
||||
|
||||
# @contest_page = FirstPage.find_by_page_type('contest')
|
||||
# @contest_notifications = Contestnotification.order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
def search
|
||||
@name = params[:q]
|
||||
@search_type = params[:search_type]
|
||||
page = (params[:page] || 1).to_i
|
||||
|
||||
@users_count = User.search(@name).results.total
|
||||
@syllabus_count = Syllabus.search(@name).results.total
|
||||
@course_count = Course.search(@name).results.total
|
||||
@attach_count = Attachment.search(@name).results.total
|
||||
@project_count = Project.search(@name).results.total
|
||||
@memo_count = Memo.search(@name).results.total
|
||||
@total_count = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
|
||||
|
||||
|
||||
case params[:search_type]
|
||||
when 'all'
|
||||
if (page-1)*20 >= @total_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
|
||||
when 'user'
|
||||
if (page-1)*20 >= @users_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@users = User.search(@name).page(page).per(20)
|
||||
when 'syllabus'
|
||||
if (page-1)*20 >= @syllabus_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@syllabuses = Syllabus.search(@name).page(page).per(20).results
|
||||
when 'project'
|
||||
if (page-1)*20 >= @project_count
|
||||
page = 1
|
||||
end
|
||||
@projects = Project.search(@name).page(page).per(20).results
|
||||
when 'course'
|
||||
if (page-1)*20 >= @course_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@courses = Course.search(@name).page(page).per(20).results
|
||||
when 'attachment'
|
||||
if (page-1)*20 >= @attach_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@attachments = Attachment.search(@name).page(page).per(20).results
|
||||
when 'memo'
|
||||
if (page-1)*20 >= @memo_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@memos = Memo.search(@name).page(page).per(20).results
|
||||
else
|
||||
if (page-1)*20 >= @total_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
# search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
# search_by = params[:search_by]
|
||||
#
|
||||
# if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
# search_type = :contests
|
||||
# search_condition = params[:name]
|
||||
# end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{ render :layout=>'users_base'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
# url = request.original_url.gsub('/','')
|
||||
# if url.include?(Setting.url_course.gsub('/',''))
|
||||
# if @first_page.show_course == 1
|
||||
# course
|
||||
# render :course
|
||||
# else
|
||||
# render_404
|
||||
# end
|
||||
#
|
||||
# return 0
|
||||
# elsif url.include?(Setting.url_contest.gsub('/',''))
|
||||
# if @first_page.show_contest == 1
|
||||
# contest
|
||||
# render :contest
|
||||
# else
|
||||
# render_404
|
||||
# end
|
||||
#
|
||||
# return 0
|
||||
# elsif url.include?(Setting.url_user.gsub('/',''))
|
||||
# #redirect_to(:controller => "users", :action => "index")
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# def render(*args)
|
||||
# _fake if @fake_filter
|
||||
# super
|
||||
# end
|
||||
|
||||
# private
|
||||
|
||||
# def fake
|
||||
# @fake_filter = true
|
||||
# end
|
||||
|
||||
# # 骗子方法
|
||||
# def _fake
|
||||
# instance_variables.map { |variable|
|
||||
# if variable.to_s =~ /Count$/
|
||||
# self.instance_variable_set(variable.to_sym,
|
||||
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
||||
# end
|
||||
# }
|
||||
# end
|
||||
|
||||
end
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class WelcomeController < ApplicationController
|
||||
# layout "base_welcome"
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
helper :project_score
|
||||
caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false
|
||||
#before_filter :find_first_page, :only => [:index]
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
skip_before_filter :check_authentication, :only => [:index]
|
||||
|
||||
def index
|
||||
# @welcome是因为有的页面不需要导航
|
||||
@welcome = true
|
||||
@courses = Course.where(:homepage_show => 1).limit(6)
|
||||
@shixuns = Shixun.where(:homepage_show => 1).limit(6)
|
||||
render :layout => 'login_bigdata'
|
||||
end
|
||||
|
||||
def robots
|
||||
@projects = Project.all_public.active
|
||||
render :layout => false, :content_type => 'text/plain'
|
||||
end
|
||||
|
||||
def course
|
||||
redirect_to signin_path
|
||||
return
|
||||
#
|
||||
# @course_page = FirstPage.find_by_page_type('course')
|
||||
# @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
|
||||
# @logoLink ||= logolink()
|
||||
end
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.find_by_page_type('course')
|
||||
logo = get_avatar?(@course_page)
|
||||
id = params[:school_id]
|
||||
logo_link = ""
|
||||
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
|
||||
else
|
||||
if id == "0"
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
else
|
||||
if id.nil?
|
||||
if School.find(User.current.user_extensions.school.id).logo_link.nil?
|
||||
logo_link = '/images/transparent.png'
|
||||
else
|
||||
logo_link = School.find(User.current.user_extensions.school.id).logo_link
|
||||
end
|
||||
else
|
||||
logo_link = School.find(id).logo_link
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return logo_link
|
||||
end
|
||||
|
||||
|
||||
def contest
|
||||
redirect_to signin_path
|
||||
return
|
||||
|
||||
# @contest_page = FirstPage.find_by_page_type('contest')
|
||||
# @contest_notifications = Contestnotification.order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
def search
|
||||
@name = params[:q]
|
||||
@search_type = params[:search_type]
|
||||
page = (params[:page] || 1).to_i
|
||||
|
||||
@users_count = User.search(@name).results.total
|
||||
@syllabus_count = Syllabus.search(@name).results.total
|
||||
@course_count = Course.search(@name).results.total
|
||||
@attach_count = Attachment.search(@name).results.total
|
||||
@project_count = Project.search(@name).results.total
|
||||
@memo_count = Memo.search(@name).results.total
|
||||
@total_count = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
|
||||
|
||||
|
||||
case params[:search_type]
|
||||
when 'all'
|
||||
if (page-1)*20 >= @total_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
|
||||
when 'user'
|
||||
if (page-1)*20 >= @users_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@users = User.search(@name).page(page).per(20)
|
||||
when 'syllabus'
|
||||
if (page-1)*20 >= @syllabus_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@syllabuses = Syllabus.search(@name).page(page).per(20).results
|
||||
when 'project'
|
||||
if (page-1)*20 >= @project_count
|
||||
page = 1
|
||||
end
|
||||
@projects = Project.search(@name).page(page).per(20).results
|
||||
when 'course'
|
||||
if (page-1)*20 >= @course_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@courses = Course.search(@name).page(page).per(20).results
|
||||
when 'attachment'
|
||||
if (page-1)*20 >= @attach_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@attachments = Attachment.search(@name).page(page).per(20).results
|
||||
when 'memo'
|
||||
if (page-1)*20 >= @memo_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@memos = Memo.search(@name).page(page).per(20).results
|
||||
else
|
||||
if (page-1)*20 >= @total_count
|
||||
page = 1
|
||||
params[:page] = "1"
|
||||
end
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
title:{},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{},
|
||||
subject:{},
|
||||
content:{}
|
||||
}
|
||||
}
|
||||
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
# search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
# search_by = params[:search_by]
|
||||
#
|
||||
# if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
# search_type = :contests
|
||||
# search_condition = params[:name]
|
||||
# end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{ render :layout=>'users_base'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
# url = request.original_url.gsub('/','')
|
||||
# if url.include?(Setting.url_course.gsub('/',''))
|
||||
# if @first_page.show_course == 1
|
||||
# course
|
||||
# render :course
|
||||
# else
|
||||
# render_404
|
||||
# end
|
||||
#
|
||||
# return 0
|
||||
# elsif url.include?(Setting.url_contest.gsub('/',''))
|
||||
# if @first_page.show_contest == 1
|
||||
# contest
|
||||
# render :contest
|
||||
# else
|
||||
# render_404
|
||||
# end
|
||||
#
|
||||
# return 0
|
||||
# elsif url.include?(Setting.url_user.gsub('/',''))
|
||||
# #redirect_to(:controller => "users", :action => "index")
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# def render(*args)
|
||||
# _fake if @fake_filter
|
||||
# super
|
||||
# end
|
||||
|
||||
# private
|
||||
|
||||
# def fake
|
||||
# @fake_filter = true
|
||||
# end
|
||||
|
||||
# # 骗子方法
|
||||
# def _fake
|
||||
# instance_variables.map { |variable|
|
||||
# if variable.to_s =~ /Count$/
|
||||
# self.instance_variable_set(variable.to_sym,
|
||||
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
||||
# end
|
||||
# }
|
||||
# end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,6 +33,15 @@ module ApplicationHelper
|
|||
extend Forwardable
|
||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||
|
||||
# 适用与已经用url_safe编码后,回调字符串形式
|
||||
def tran_base64_decode64 str
|
||||
if str.blank?
|
||||
str
|
||||
else
|
||||
Base64.decode64(str.tr("-_", "+/")).force_encoding("utf-8")
|
||||
end
|
||||
end
|
||||
|
||||
def open_webssh
|
||||
# 如果我webssh类型, 开启webssh
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
|
|
@ -67,39 +76,30 @@ module ApplicationHelper
|
|||
# 若实训有更改,则修改已发不实训的标记为已更改
|
||||
# shixun_modifies表中1表示已更改,进入myshixun需要强制重置,0表示没有修改
|
||||
# type 0:表示已经是最新的了;1:表示已经有修改
|
||||
# 功能:1、产生变更记录;2、生成pipeline脚本
|
||||
# res返回结果0表示正确,-1表示有异常
|
||||
def add_shixun_modify_status shixun, type
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
gameInfo = shixun.gameInfo
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/publishGame")
|
||||
uri ="#{shixun_tomcat}/bridge/game/publishGame"
|
||||
params = {gameInfo:gameInfo}
|
||||
res = uri_exec uri, params
|
||||
if res && res['code'].to_i != 0
|
||||
raise("实训云平台繁忙(繁忙等级:90)")
|
||||
end
|
||||
myshixuns = shixun.myshixuns
|
||||
unless myshixuns.blank?
|
||||
myshixuns.each do |myshixun|
|
||||
shixun_modify = ShixunModify.where(:shixun_id => shixun.id, :myshixun_id => myshixun.id).first
|
||||
if shixun_modify.nil?
|
||||
ShixunModify.create(:shixun_id => shixun.id, :myshixun_id => myshixun.id, :status => type)
|
||||
else
|
||||
shixun_modify.update_attribute(:status, type)
|
||||
end
|
||||
end
|
||||
end
|
||||
shixun_modify_status_without_publish shixun, type
|
||||
end
|
||||
|
||||
# 仅仅产生记录,用于已执行publish的方法
|
||||
# ShixunModify中status 1:表示有更改,开启实训的时候需要重置,0:表示不需要重置或已重置完成
|
||||
def shixun_modify_status_without_publish shixun, type
|
||||
myshixuns = shixun.myshixuns
|
||||
unless myshixuns.blank?
|
||||
myshixuns.each do |myshixun|
|
||||
shixun_modify = ShixunModify.where(:shixun_id => shixun.id, :myshixun_id => myshixun.id).first
|
||||
if shixun_modify.nil?
|
||||
ShixunModify.create(:shixun_id => shixun.id, :myshixun_id => myshixun.id, :status => type)
|
||||
ShixunModify.create!(:shixun_id => shixun.id, :myshixun_id => myshixun.id, :status => type)
|
||||
else
|
||||
shixun_modify.update_attribute(:status, type)
|
||||
shixun_modify.update_attributes!(:status => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -122,7 +122,7 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
file_content = Base64.decode64(file_content) unless file_content.blank?
|
||||
file_content = tran_base64_decode64(file_content)
|
||||
game_code = GameCode.where(:game_id => game_id).first
|
||||
if game_code.nil?
|
||||
if type == 0
|
||||
|
|
@ -155,16 +155,16 @@ module ApplicationHelper
|
|||
grade = Grade.where(:user_id => user.id, :container_id => container_id, :container_type => container_type).first
|
||||
if grade.nil?
|
||||
Grade.create!(:user_id => user.id, :container_id => container_id, :container_type => container_type, :score => score)
|
||||
user.update_column(:grade, (score.to_i + user.grade.to_i))
|
||||
end
|
||||
user.update_column(:grade, (score.to_i + user.grade.to_i))
|
||||
end
|
||||
|
||||
def reward_experience(user, container_id, container_type, score)
|
||||
experience = Experience.where(:user_id => user.id, :container_id => container_id, :container_type => container_type).first
|
||||
if experience.nil?
|
||||
Experience.create!(:user_id => user.id, :container_id => container_id, :container_type => container_type, :score => score)
|
||||
user.update_column(:experience, (score.to_i + user.experience.to_i))
|
||||
end
|
||||
user.update_column(:experience, (score.to_i + user.experience.to_i))
|
||||
end
|
||||
|
||||
# codeMirror语言转换
|
||||
|
|
@ -425,6 +425,7 @@ module ApplicationHelper
|
|||
def uri_exec uri, params
|
||||
begin
|
||||
logger.error("@parmas is #{params}, url is #{uri}")
|
||||
uri = URI.parse(URI.encode(uri.strip))
|
||||
res = Net::HTTP.post_form(uri, params).body
|
||||
res = JSON.parse(res)
|
||||
rescue => e
|
||||
|
|
@ -3012,9 +3013,8 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def identity_authentication_status user_id
|
||||
apply = ApplyAction.where(:user_id => user_id).first
|
||||
case apply.try(:status)
|
||||
def identity_authentication_status status
|
||||
case status
|
||||
when nil
|
||||
"未授权"
|
||||
when 0
|
||||
|
|
@ -3026,6 +3026,38 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def user_certification_status user
|
||||
status = ""
|
||||
if user.authentication
|
||||
status = "已实名认证"
|
||||
else
|
||||
apply_auth = ApplyUserAuthentication.where(:user_id => user.id, :auth_type => 1).last
|
||||
if apply_auth && apply_auth.status == 0
|
||||
status = "实名认证中"
|
||||
elsif apply_auth && apply_auth.status == 2
|
||||
status = "实名认证未通过"
|
||||
else
|
||||
status = "未实名认证"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pro_certification_status user
|
||||
status = ""
|
||||
if user.professional_certification
|
||||
status = "已职业认证"
|
||||
else
|
||||
apply_auth = ApplyUserAuthentication.where(:user_id => user.id, :auth_type => 2).last
|
||||
if apply_auth && apply_auth.status == 0
|
||||
status = "职业认证中"
|
||||
elsif apply_auth && apply_auth.status == 2
|
||||
status = "职业认证未通过"
|
||||
else
|
||||
status = "未职业认证"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def shixun_authentication_status shixun
|
||||
case shixun.try(:status)
|
||||
when 0,nil
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
module KuberneteHelper
|
||||
end
|
||||
|
|
@ -1,20 +1,33 @@
|
|||
module ManagementsHelper
|
||||
|
||||
def trial_authorization_status status
|
||||
case status
|
||||
when "0", nil
|
||||
0
|
||||
when "1"
|
||||
1
|
||||
when "2"
|
||||
2
|
||||
else
|
||||
[1,2]
|
||||
end
|
||||
end
|
||||
|
||||
def query_user_status_num status
|
||||
user = (status == 0) ? user = User.all : User.where(:status => status)
|
||||
return user.count
|
||||
end
|
||||
end
|
||||
module ManagementsHelper
|
||||
|
||||
def trial_authorization_status status
|
||||
case status
|
||||
when "0", nil
|
||||
0
|
||||
when "1"
|
||||
1
|
||||
when "2"
|
||||
2
|
||||
else
|
||||
[1,2]
|
||||
end
|
||||
end
|
||||
|
||||
def query_user_status_num status
|
||||
user = (status == 0) ? user = User.all : User.where(:status => status)
|
||||
return user.count
|
||||
end
|
||||
|
||||
def course_list_major_time id
|
||||
Major.where(:id => id).first.try(:name)
|
||||
end
|
||||
|
||||
# params[:id]: course_list_id
|
||||
def get_course_list_major id
|
||||
Major.where(:id => MajorCourse.where(:course_list_id => id).map(&:major_id))
|
||||
end
|
||||
|
||||
def course_list_count id
|
||||
Major.where(:id => id).first.try(:name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
class ApplyAddSchools < ActiveRecord::Base
|
||||
# status:0 未审批 ; 1 已批阅
|
||||
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
|
||||
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
|
||||
belongs_to :school
|
||||
|
||||
#after_create :send_massage
|
||||
end
|
||||
class ApplyAddSchools < ActiveRecord::Base
|
||||
# status:0 未审批 ; 1 已批阅, :2 已拒绝
|
||||
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
|
||||
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
|
||||
belongs_to :school
|
||||
|
||||
#after_create :send_massage
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Course < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term, :choose_group_allow, :is_end
|
||||
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term, :choose_group_allow, :is_end, :homepage_show
|
||||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id, :dependent => :destroy # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||
|
|
@ -105,7 +105,8 @@ class Course < ActiveRecord::Base
|
|||
'end_term',
|
||||
'os_allow',
|
||||
'choose_group_allow',
|
||||
'credit'
|
||||
'credit',
|
||||
'homepage_show'
|
||||
|
||||
acts_as_customizable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
class Experience < ActiveRecord::Base
|
||||
attr_accessible :container_id, :container_type, :score, :user_id
|
||||
attr_accessible :container_id, :container_type, :score, :user_id, :created_at, :updated_at
|
||||
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,6 +22,14 @@ class Game < ActiveRecord::Base
|
|||
identifier
|
||||
end
|
||||
|
||||
def query_index
|
||||
if self.outputs.present?
|
||||
self.outputs.first.try(:query_index).to_i + 1
|
||||
else
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
def last_game
|
||||
challenge = self.challenge
|
||||
last_challenge_id = challenge.last_challenge
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# container_type:
|
||||
# Phone-手机注册;Mail-邮箱绑定;Account-完善资料
|
||||
# Phone-手机注册;Mail-邮箱绑定;Account-完善资料;Answer-查看参考答案;Game-闯关
|
||||
class Grade < ActiveRecord::Base
|
||||
attr_accessible :container_id, :container_type, :score, :user_id
|
||||
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
class Output < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
# actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E)
|
||||
default_scope :order => 'test_set_position desc'
|
||||
default_scope :order => 'query_index desc'
|
||||
belongs_to :game
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@
|
|||
#
|
||||
class Shixun < ActiveRecord::Base
|
||||
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication,
|
||||
:myshixun_count, :propaedeutics, :trainee, :major_id
|
||||
:myshixun_count, :propaedeutics, :trainee, :major_id, :homepage_show
|
||||
|
||||
has_many :users, :through => :shixun_members
|
||||
has_many :shixun_members, :dependent => :destroy
|
||||
has_one :repository, :dependent => :destroy
|
||||
has_many :homework_commons_shixunses
|
||||
has_many :challenges, :dependent => :destroy, :order => "challenges.id ASC"
|
||||
has_many :challenges, :dependent => :destroy, :order => "challenges.position ASC"
|
||||
has_many :myshixuns, :dependent => :destroy
|
||||
has_many :stage_shixuns, :dependent => :destroy
|
||||
belongs_to :major
|
||||
|
|
@ -39,21 +39,19 @@ class Shixun < ActiveRecord::Base
|
|||
challenges.each do |challenge|
|
||||
pipeline_script = {:challengeStage => "#{challenge.position}",
|
||||
:challengeType => "#{challenge.evaluation_way.to_i}",
|
||||
:challengeProgramName => "#{challenge.exec_path}",
|
||||
:operationEnvironment => "#{post_tomcat_language(self.language, challenge.exec_path)}",
|
||||
:trainingID => "#{self.id}"}
|
||||
:challengeProgramName => "#{challenge.exec_path}"}
|
||||
fragments << pipeline_script
|
||||
# 每一关所有的测试集
|
||||
challenge.test_sets.each do |test_set|
|
||||
test_cases = {:caseId => test_set.id.to_s, :input => test_set.input, :output => test_set.output, :isPublic => (test_set.is_public ? "1" : "0")}
|
||||
test_cases = {:input => test_set.input, :output => test_set.output}
|
||||
testSet << test_cases
|
||||
end
|
||||
test_sets_list = {:challengeStage => challenge.position.to_s, :challengeTestCases => testSet}
|
||||
testCases << test_sets_list
|
||||
testSet = []
|
||||
end
|
||||
gameInfo = {:trainingID => self.id.to_s, :operationEnvironment => "#{post_tomcat_language(self.language, challenges.first.try(:exec_path))}", :challengeInfo => fragments, :testCases => testCases}
|
||||
gameInfo = Base64.strict_encode64(gameInfo.to_json) unless gameInfo.blank?
|
||||
gameInfo = {:tpmID => self.id.to_s, :operationEnvironment => "#{self.try(:language)}", :challengeInfo => fragments, :testCases => testCases}
|
||||
gameInfo = Base64.urlsafe_encode64(gameInfo.to_json) unless gameInfo.blank?
|
||||
return gameInfo
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class ShixunMajorCourse < ActiveRecord::Base
|
||||
belongs_to :shixun
|
||||
belongs_to :major
|
||||
belongs_to :course_list
|
||||
#attr_accessible :course_list
|
||||
end
|
||||
class ShixunMajorCourse < ActiveRecord::Base
|
||||
belongs_to :shixun
|
||||
belongs_to :major
|
||||
belongs_to :course_list
|
||||
#attr_accessible :course_list
|
||||
end
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ class User < Principal
|
|||
has_many :shixuns, :through => :shixun_members
|
||||
has_many :shixun_members, :dependent => :destroy
|
||||
has_many :challenges, :dependent => :destroy
|
||||
has_many :games, :dependent => :destroy
|
||||
|
||||
has_many :subjects
|
||||
|
||||
|
|
@ -202,6 +203,9 @@ class User < Principal
|
|||
#####
|
||||
has_many :shares ,:dependent => :destroy
|
||||
|
||||
has_many :grades
|
||||
has_many :experiences
|
||||
|
||||
###
|
||||
has_many :apply_actions, :dependent => :destroy
|
||||
|
||||
|
|
@ -310,6 +314,11 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
}
|
||||
def challenge_tags
|
||||
games = self.games.where(:id => self.experiences.map(&:container_id), :status => 2)
|
||||
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)).where("name != ''")
|
||||
end
|
||||
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
|
|
@ -962,8 +971,7 @@ class User < Principal
|
|||
|
||||
# 超级管理员或者role为1
|
||||
def manager_of_myshixun?(myshixun)
|
||||
member = MyshixunMember.where(:user_id => self.id, :myshixun_id => myshixun.id, :role => 1)
|
||||
(!member.blank? || User.current.admin?) ? true : false
|
||||
(User.current.id == myshixun.user_id || User.current.admin?) ? true : false
|
||||
end
|
||||
|
||||
def member_of_course?(course)
|
||||
|
|
@ -1420,21 +1428,21 @@ class User < Principal
|
|||
# 为新注册用户发送留言
|
||||
# 只发三条没可以不用delay job,而且这个最好是注册的时候就能看到
|
||||
def add_new_jour
|
||||
Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
lead_message1 = Message.find(19292)
|
||||
notes1 = lead_message1.content
|
||||
lead_message2 = Message.find(19291)
|
||||
notes2 = lead_message2.content
|
||||
lead_message3 = Message.find(19504)
|
||||
notes3 = lead_message3.content
|
||||
#user_id 默认为课程使者创建
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
end
|
||||
end
|
||||
# Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
# if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
# if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
# lead_message1 = Message.find(19292)
|
||||
# notes1 = lead_message1.content
|
||||
# lead_message2 = Message.find(19291)
|
||||
# notes2 = lead_message2.content
|
||||
# lead_message3 = Message.find(19504)
|
||||
# notes3 = lead_message3.content
|
||||
# #user_id 默认为课程使者创建
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# end
|
||||
# end
|
||||
# self.delay.add_new_jour_delay
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="panel-cer-content">
|
||||
<p class="border-dash-orange pt5 pb5 mb20"><i class="fa fa-exclamation-circle u-color-light-red ml10 mr5 font-16"></i><span class="u-color-light-red mr15">认证中</span>我们将在1个工作日内完成审核,通过审核后页面会显示“已认证”</p>
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -43,12 +43,12 @@
|
|||
<td><%= @user.try(:ID_number) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">手持身份证正面头部照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
<td>手持身份证正面头部照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="mt10">若您想重新认证,请先<a href="javascript:void(0);" class="color-blue" onclick="s_op_confirm_box('<%= cancel_pro_apply_account_path(:auth_type => 1) %>', '是否确定撤销提交的实名认证申请')">撤销本次认证申请</a></p>
|
||||
<p class="mt10 color-dark-grey">若您想重新认证,请先<a href="javascript:void(0);" class="color-blue" onclick="s_op_confirm_box('<%= cancel_pro_apply_account_path(:auth_type => 1) %>', '是否确定撤销提交的实名认证申请')">撤销本次认证申请</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif !@user.authentication && @apply_user_auth && @apply_user_auth.status == 2 %>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<div class="panel-cer-content">
|
||||
<p class="border-error-result pt5 pb5 mb20"><i class="fa fa-times-circle color-red ml10 mr5 font-16"></i><span class="color-red mr15">未通过</span>原因:<span class="color-red"><%= @apply_user_auth.remarks %></span></p>
|
||||
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -84,12 +84,12 @@
|
|||
<td><%= @user.try(:ID_number) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">手持身份证正面头部照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
<td>手持身份证正面头部照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="mt10">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="real_certification();">点击这里</a></p>
|
||||
<p class="mt10 color-dark-grey">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="real_certification();">点击这里</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif @user.authentication %>
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
<div class="panel-cer-content">
|
||||
<p class="pt5 pb5 mb20"><i class="fa fa-check-circle color-light-green ml10 mr5 font-16"></i><span class="color-light-green mr15">已认证</span></p>
|
||||
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -125,8 +125,8 @@
|
|||
<td><%= @user.try(:ID_number) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">手持身份证正面头部照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
<td>手持身份证正面头部照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'ID'), :width => 200, :height => 150, :id => "upload_id_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="panel-cer-content">
|
||||
<p class="border-dash-orange pt5 pb5 mb20"><i class="fa fa-exclamation-circle u-color-light-red ml10 mr5 font-16"></i><span class=" u-color-light-red mr15">认证中</span>我们将在1个工作日内完成审核,通过审核后页面会显示“已认证”</p>
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -47,8 +47,8 @@
|
|||
<td><%= @user.user_extensions.department ? @user.user_extensions.department.try(:name) : '' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">职业证正面照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
<td>职业证正面照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
<div class="panel-cer-content">
|
||||
<p class="border-error-result pt5 pb5 mb20"><i class="fa fa-times-circle color-red ml10 mr5 font-16"></i><span class="color-red mr15">未通过</span>原因:<span class="color-red"><%= @apply_user_auth.remarks %></span></p>
|
||||
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -92,12 +92,12 @@
|
|||
<td><%= @user.user_extensions.department ? @user.user_extensions.department.try(:name) : '' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">职业证正面照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
<td>职业证正面照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="mt10">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="pro_certification();">点击这里</a></p>
|
||||
<p class="mt10 color-dark-grey">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="pro_certification();">点击这里</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif @user.professional_certification %>
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
<div class="panel-cer-content">
|
||||
<p class="pt5 pb5 mb20"><i class="fa fa-check-circle color-light-green ml10 mr5 font-16"></i><span class="color-light-green mr15">已认证</span></p>
|
||||
|
||||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0">
|
||||
<table class="edu-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left" class="pl15">认证信息</th>
|
||||
|
|
@ -137,12 +137,12 @@
|
|||
<td><%= @user.user_extensions.department ? @user.user_extensions.department.try(:name) : '' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">职业证正面照:</td>
|
||||
<td style="border-bottom: 1px solid #EEEEEE">已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
<td>职业证正面照:</td>
|
||||
<td>已上传<a href="javascript:void(0);" class="ml15 color-blue">查看</a><%= image_tag(url_to_auth_img(@user.id, 'PRO'), :width => 200, :height => 150, :id => "upload_pro_image", :class => "none") %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="mt10">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="pro_certification();">点击这里</a></p>
|
||||
<p class="mt10 color-dark-grey">若您想重新认证,请<a href="javascript:void(0);" class="color-blue" onclick="pro_certification();">点击这里</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
<div id="challenge_answer" class="new_li">
|
||||
<textarea name="challenge[answer]"><%= @challenge.answer %></textarea>
|
||||
</div>
|
||||
<p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p>
|
||||
<p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-green fr" onclick="$('#challenge_shixun_answer_update').submit();">保存</a>
|
||||
|
|
@ -71,7 +73,18 @@
|
|||
$("[type=\"inline\"]").attr("title", "行内公式");
|
||||
$("[type=\"latex\"]").attr("title", "多行公式");
|
||||
|
||||
// 实训简介自动保存
|
||||
md_elocalStorage(answer_editormd, "challenge_in_<%= User.current.id %>", "in");
|
||||
};
|
||||
// md恢复上次数据
|
||||
function md_rec_data(k,mdu,id){
|
||||
console.log(k);
|
||||
if(window.sessionStorage.getItem(k+mdu) !== null){
|
||||
answer_editormd.setValue(window.sessionStorage.getItem(k+mdu));
|
||||
md_clear_data(k,mdu,id);
|
||||
}
|
||||
}
|
||||
|
||||
/* $("#answer_cancel").click(function(){
|
||||
$("#answer_edit").hide();
|
||||
$("#edit_answer_show").show();
|
||||
|
|
|
|||
|
|
@ -39,22 +39,23 @@
|
|||
<% if User.current.manager_of_shixun?(@shixun) %>
|
||||
<p class="fr" id="shixun_icon_<%= index %>">
|
||||
<% if @shixun.status == 0 %>
|
||||
<a href="javascript:void(0);" class="mr5" onclick="delete_confirm_box_2('<%= shixun_challenge_path(challenge, :shixun_id => @shixun) %>', '确定要删除该任务吗?')" data-tip-down="删除" ><i class="fa fa-trash-o color-grey font-16" ></i></a>
|
||||
<% unless challenge.position < 2 %>
|
||||
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
||||
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" data-tip-down="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
||||
<% end %>
|
||||
<% if @shixun.challenges.count != challenge.position %>
|
||||
<a href="<%= index_down_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="下移" data-remote="true"><i class="fa fa-long-arrow-down color-grey font-16 mr5" ></i></a>
|
||||
<a href="<%= index_down_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" data-tip-down="下移" data-remote="true"><i class="fa fa-long-arrow-down color-grey font-16 mr5" ></i></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<a href="<%= edit_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="编辑" ><i class="fa fa-pencil-square-o color-grey font-16 mr5" ></i></a>
|
||||
<a href="<%= edit_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" data-tip-down="编辑"><i class="fa fa-pencil-square-o color-grey font-16 mr5" ></i></a>
|
||||
<!-- <a href="#" title="删除" ><i class="fa fa-trash-o color-grey font-16 mr5" ></i></a>-->
|
||||
<!--<a href="#" title="排名" ><i class="fa fa-signal color-grey font-16 mr5 " ></i></a>-->
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<p class="ml25 color-grey challenge_details">
|
||||
<span class="mr100 itoblock_w150"><%= shixun_running(@shixun, challenge.position).to_i %>人 正在挑战</span>
|
||||
<span class="mr100 itoblock_w150"><%= shixun_done(@shixun, challenge.position).to_i %>人 完成挑战</span>
|
||||
<span class="mr100 itoblock_w150"><%= shixun_running(@shixun, challenge.position).to_i %>人 正在挑战</span>
|
||||
<span class="mr100 w150 g_frame"><%= challenge.score %>经验值</span>
|
||||
<span class="mr400 fr"><%= find_game_status challenge.id %></span>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
</ul>
|
||||
</div>
|
||||
<ul class="<%= @challenge_tags.blank? ? "" : "undis" %>" id="skill_edit">
|
||||
<%= labelled_form_for @challenge, :url => update_evaluation_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5), :html => {:id => "challenge_skill_update"} do |f| %>
|
||||
<%= form_for @challenge, :url => update_evaluation_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5),
|
||||
:html => {:id => "challenge_skill_update", :onkeydown => "if(event.keyCode==13)return false;"} do |f| %>
|
||||
<%= render :partial => "skill_form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@
|
|||
|
||||
<div id="shixun_form">
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">文件路径:</label>
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>文件路径:</label>
|
||||
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %>
|
||||
<span style="display: none" class="c_red ml95" id="challenge_file_path">文件路径不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">执行文件:</label>
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>执行文件:</label>
|
||||
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:src/test/main.java", :maxlength => "256" %>
|
||||
<span style="display: none" class="c_red ml95" id="challenge_execfile_path">执行文件不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>评测方式:</label>
|
||||
|
|
@ -179,8 +181,24 @@
|
|||
// 提交表单
|
||||
function submit_shixun_evaluating(){
|
||||
test_set_whether_lock();
|
||||
if($("input[name='challenge[path]']").val().trim() == ""){
|
||||
$("#challenge_file_path").show();
|
||||
return;
|
||||
}else if($("input[name='challenge[exec_path]']").val().trim() == ""){
|
||||
$("#challenge_execfile_path").show();
|
||||
return;
|
||||
}
|
||||
$('#challenge_evaluation_update').submit();
|
||||
}
|
||||
|
||||
$("input[name='challenge[path]']").on("focus", function(){
|
||||
$("#challenge_file_path").hide();
|
||||
});
|
||||
|
||||
$("input[name='challenge[exec_path]']").on("focus", function(){
|
||||
$("#challenge_execfile_path").hide();
|
||||
});
|
||||
|
||||
/* $("#evaluating_cancel").click(function(){
|
||||
$("#evaluating_edit").hide();
|
||||
$("#evaluating_show").show();
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>名称:</label>
|
||||
<%= f.text_field :subject, :class => "panel-form-width-690 fl panel-box-sizing", :no_label => true, :placeholder => "请输入当前任务的名称(此信息将提前泄露给学员)" %>
|
||||
<span style="display: none" class="c_red ml95" id="new_shixun_name">任务名称不能为空</span>
|
||||
<span style="display: none;margin-left: 10%;" class="c_red ml95" id="new_shixun_name">任务名称不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">文件路径:</label>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
<%#= f.text_area :ready_knowledge, :placeholder => "请输入完成当前任务依赖的知识点或者其它相关信息,指导学员完成任务" %>
|
||||
<textarea name="challenge[task_pass]"><%= @challenge.task_pass %></textarea>
|
||||
</div>
|
||||
<span style="display: none" class="c_red ml95" id="new_shixun_pass">过关任务不能为空</span>
|
||||
<span style="display: none;margin-left: 10%;" class="c_red" id="new_shixun_pass">过关任务不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>评测方式:</label>
|
||||
|
|
|
|||
|
|
@ -22,20 +22,22 @@
|
|||
<div class="prop-notice-info mb10 ml95">
|
||||
<ol>
|
||||
<% if @st == 0 %>
|
||||
<li>学员为参考答案通过了本阶段的评测时将获得技能,否则不能获得技能</li>
|
||||
<li>学员未参考答案通过了本阶段的评测时将获得技能,否则不能获得技能</li>
|
||||
<% else %>
|
||||
<li>学员答题正确将获得技能,否则不能获得技能</li>
|
||||
<% end %>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-green fr" onclick="challenge_skill_update();">保存</a>
|
||||
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5) %>" class="task-btn fr mr10" id="skill_cancel">取消</a>
|
||||
</li>
|
||||
<!--<li class="clearfix">-->
|
||||
<!--<a href="javascript:void(0);" class="task-btn task-btn-green fr" onclick="challenge_skill_update();">保存</a>-->
|
||||
<!--<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 5) %>" class="task-btn fr mr10" id="skill_cancel">取消</a>-->
|
||||
<!--</li>-->
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var SnSkill = $(".knowledge_frame").length;
|
||||
|
||||
function add_tag(){
|
||||
var num = $(".task-bd-grey").children('div').length;
|
||||
var val = $(".task-tag-input").val().trim();
|
||||
|
|
@ -56,14 +58,29 @@
|
|||
var obj = $(thisObj).parent();
|
||||
$(obj).remove();
|
||||
}
|
||||
|
||||
function challenge_skill_update(){
|
||||
var nSkill = $(".knowledge_frame");
|
||||
add_tag();
|
||||
if (nSkill.length > 0){
|
||||
$("#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")){
|
||||
return;
|
||||
}else{
|
||||
$("#stage_name_notice").show();
|
||||
var nSkill = $(".knowledge_frame");
|
||||
add_tag();
|
||||
if (nSkill.length > 0){
|
||||
if(nSkill.length!==SnSkill) {
|
||||
$("#challenge_skill_update").submit(); //当增加或者保存技能标签以后执行保存操作
|
||||
}
|
||||
|
||||
}else{
|
||||
$("#stage_name_notice").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// function challenge_skill_update(){
|
||||
// var nSkill = $(".knowledge_frame");
|
||||
// add_tag();
|
||||
// if (nSkill.length > 0){
|
||||
// $("#challenge_skill_update").submit();
|
||||
// }else{
|
||||
// $("#stage_name_notice").show();
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -23,14 +23,16 @@
|
|||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>名称:</label>
|
||||
<%= f.text_field :subject, :class => "panel-form-width-690 fl panel-box-sizing", :no_label => true, :placeholder => "请输入当前任务的名称(此信息将提前泄露给学员)" %>
|
||||
<span style="display: none" class="c_red ml95" id="new_shixun_name">任务名称不能为空</span>
|
||||
<span style="display: none;margin-left: 10%;" class="c_red" id="new_shixun_name">任务名称不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>过关任务:</label>
|
||||
<div id="challenge_task_pass" class="new_li">
|
||||
<textarea name="challenge[task_pass]"><%= @challenge.task_pass %></textarea>
|
||||
</div>
|
||||
<span style="display: none" class="c_red ml95" id="new_shixun_pass">过关任务不能为空</span>
|
||||
<p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p>
|
||||
<p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p>
|
||||
<span style="display: none;margin-left: 10%;" class="c_red" id="new_shixun_pass">过关任务不能为空</span>
|
||||
</li>
|
||||
<% if @st != 0 %>
|
||||
<% if params[:action] == "edit" && @challenge.challenge_questions.count > 0 %>
|
||||
|
|
@ -167,7 +169,18 @@
|
|||
$("#current-option").html("请点击正确选项");
|
||||
}
|
||||
});
|
||||
|
||||
// 实训简介自动保存
|
||||
md_elocalStorage(taskpass_editormd, "challenge_in_<%= User.current.id %>", "in");
|
||||
});
|
||||
// md恢复上次数据
|
||||
function md_rec_data(k,mdu,id){
|
||||
console.log(k);
|
||||
if(window.sessionStorage.getItem(k+mdu) !== null){
|
||||
taskpass_editormd.setValue(window.sessionStorage.getItem(k+mdu));
|
||||
md_clear_data(k,mdu,id);
|
||||
}
|
||||
}
|
||||
//设置选项答案
|
||||
function selectchoice(item, st){
|
||||
//判断是否选中,如果选中,再次点击的时候取消选中
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
$("#challenge_list").html('<%= escape_javascript( render :partial => 'content_list') %>');
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="task-pm-content mb20">
|
||||
<div class="task-pm-box mt20">
|
||||
<div class="panel-header clearfix">
|
||||
|
|
|
|||
|
|
@ -39,6 +39,19 @@
|
|||
$("#textCount").text(50-$("#subject").val().length)
|
||||
}
|
||||
});
|
||||
|
||||
$("#message_to_admin").on("click", function(){
|
||||
if($("#subject").val().trim() == ""){
|
||||
$("#error_tip").show();
|
||||
return;
|
||||
}else{
|
||||
$('#new_memo').submit();
|
||||
}
|
||||
})
|
||||
|
||||
$("#subject").on("focus", function(){
|
||||
$("#error_tip").hide();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
@ -58,8 +71,9 @@
|
|||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||
<%= f.text_area :subject, :id=>"subject", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议,您也可以通过QQ留言,谢谢!" %>
|
||||
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<span class="fl c_red undis" id="error_tip">留言不能为空 </span>
|
||||
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">留 言</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" id="message_to_admin">留 言</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">取 消</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -26,5 +26,7 @@
|
|||
lint: true,
|
||||
readOnly: "nocursor"
|
||||
});
|
||||
shixun_show_CodeMirror.setSize("auto","auto");
|
||||
$(function(){
|
||||
shixun_show_CodeMirror.setSize("auto","auto");
|
||||
});
|
||||
</script>
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
<ul class="task-index-head-info clearfix">
|
||||
<li><span class="color-orange font-bd" id="all_syllabuses"><%= @syllabuses_num %></span><br/><span >全部</span></li>
|
||||
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @create_syllabuses_count + @join_syllabuses_count %></span><br/><span>我的课堂</span></li>
|
||||
<%= link_to "+ 新建".html_safe, new_course_path, :class => "color-light-green fr mt15 font-16" %>
|
||||
<%= link_to "+ 加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "color-light-green fr mt15 mr15 font-16" %>
|
||||
<%= link_to "+ 新建".html_safe, new_course_path, :class => "color-light-green fr font-16" , :style => "line-height:56px"%>
|
||||
<%= link_to "+ 加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "color-light-green fr mr30 font-16" , :style => "line-height:56px" %>
|
||||
<!-- <li><span class="color-orange font-bd"><%#= @create_syllabuses_count %></span><br/><span>你已创建</span></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<i class="fa fa-map-marker mr5 color-grey"></i>
|
||||
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %>
|
||||
</p>
|
||||
<div class="user_bg_shadow bor-grey-e">
|
||||
<div class="edu-con-top ">
|
||||
<span class="ml15 color-grey font-16">新建课堂</span>
|
||||
</div>
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="codotab_con_1" style="overflow-y: auto;">
|
||||
<div id="codotab_con_1" style="overflow-y: auto;height: 100%">
|
||||
<div class="panel-header clearfix" id="top_repository" style="border-bottom:0;padding:15px;">
|
||||
<p class="mb10 color-light-green font-16 <%= @game.outputs.blank? || !@game.outputs.first.result ? "undis" : "" %>" id="correct_tip">
|
||||
<i class="fa fa-check-circle font-16"></i> 正确
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<i class="fa fa-exclamation-circle font-16"></i> 错误
|
||||
</p>
|
||||
<% @game_challenge.challenge_questions.each_with_index do |question, i| %>
|
||||
<div class="card quiz-task-options -elevation-1 mb20 color-grey-bf color_white <%= (@user_answer.nil? || @user_answer.index(i.to_s).nil?) ? "" : "card-check" %>" onclick="choice_answer('<%= @st %>', this)">
|
||||
<div class="card quiz-task-options -elevation-1 mb20 color-grey-bf <%= (@user_answer.nil? || @user_answer.index(i.to_s).nil?) ? "" : "card-check color_white" %>" onclick="choice_answer('<%= @st %>', this)">
|
||||
<input type="hidden" name="answer" value="<%= question.position %>">
|
||||
<div class="-layout-h -center break_word">
|
||||
<span class="mr10"><%= (question.position + 65).chr %>.</span>
|
||||
|
|
@ -29,19 +29,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function choice_answer(st, nThis){
|
||||
if(st == "1"){
|
||||
//$(nThis).hasClass("card-check") ? $(nThis).removeClass("card-check") : $(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
} else if (st == "2"){
|
||||
var choice = $(".color_white");
|
||||
choice.removeClass("card-check");
|
||||
choice.removeClass("color_white");
|
||||
$(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
:remote => true %>
|
||||
<!--<a href="javascript:void(0);" onclick="shixun_next_step();" class="task-btn task-btn-blue mr15 mt8">下 一 步</a>-->
|
||||
<% else %>
|
||||
<a href="<%= shixun_path(@shixun) %>" class="shixun-task-btn task-btn-blue mt8 mr15">退出实训</a>
|
||||
<a href="<%= shixun_path(@shixun) %>" id="exit_shixun" class="shixun-task-btn task-btn-blue mt8 mr15">退出实训</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -78,9 +78,11 @@
|
|||
|
||||
/* -----------------下一关增加loading效果--------------------- */
|
||||
$("#next_step").live("click", function(){
|
||||
nNext = $("#code_estimate");
|
||||
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
|
||||
nNext.html(html);
|
||||
if($("#next_step").attr("href") != "javascript:void(0);"){
|
||||
nNext = $("#code_estimate");
|
||||
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
|
||||
nNext.html(html);
|
||||
}
|
||||
});
|
||||
|
||||
// 选择题提交评测
|
||||
|
|
@ -112,6 +114,9 @@
|
|||
if(data.correct){
|
||||
$("#correct_tip").show();
|
||||
$("#user_grade").html(data.grade);
|
||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
|
||||
if( data.had_done == 0 ) {
|
||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
||||
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
|
||||
|
|
@ -123,6 +128,10 @@
|
|||
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
|
||||
}else{
|
||||
$("#error_tip").show();
|
||||
var span_class = parseInt(data.score) < 0 ? "u-color-light-red" : "color-light-green";
|
||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+0</span>");
|
||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='"+ span_class +" mr5'>"+ data.score + "</span>");
|
||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+0</span>");
|
||||
if(0 == data.had_done){
|
||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
||||
}else if(1 == data.had_done ){
|
||||
|
|
@ -132,7 +141,7 @@
|
|||
}
|
||||
},
|
||||
error: function(){
|
||||
alert("错了");
|
||||
console.log("错了");
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -141,30 +150,29 @@
|
|||
/* ----------------- 评测 -------------------- */
|
||||
function training_task_submmit(){
|
||||
// 加载页面
|
||||
nEvalContent = $("#evaluating_contents");
|
||||
nEvalInfo = $("#evaluating_info");
|
||||
//nHtmlContent = $("#html_contents");
|
||||
nAjaxLoading = $("#evaluating_ajax_loading");
|
||||
//nHtmlAjaxLoading = $("#html_ajax_loading");
|
||||
nInfoAjaxLoading = $("#info_ajax_loading");
|
||||
nAjaxLoading.css("display","flex");
|
||||
nInfoAjaxLoading.css("display","flex");
|
||||
//nHtmlAjaxLoading.css("display","flex");
|
||||
nEvalContent.hide();
|
||||
nEvalInfo.hide();
|
||||
//nHtmlContent.hide();
|
||||
nAjaxLoading.show();
|
||||
nInfoAjaxLoading.show();
|
||||
// nHtmlAjaxLoading.show();
|
||||
nAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nInfoAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
//nHtmlAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nEvalContent = $("#evaluating_contents").hide();
|
||||
nEvalInfo = $("#evaluating_info").hide();
|
||||
nAjaxLoading = $("#evaluating_ajax_loading").css("display","flex").show().html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nInfoAjaxLoading = $("#info_ajax_loading").css("display","flex").show().html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
// nAjaxLoading.css("display","flex");
|
||||
// nInfoAjaxLoading.css("display","flex");
|
||||
// nEvalContent.hide();
|
||||
// nEvalInfo.hide();
|
||||
// nAjaxLoading.show();
|
||||
// nInfoAjaxLoading.show();
|
||||
// nAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
// nInfoAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
$("#code_test").html("<a class='task-btn mt8 mr15'>评测中..</a>");
|
||||
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
|
||||
if($("#next_step").length > 0){
|
||||
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关</a>");
|
||||
} else if($("#exit_shixun").length > 0){
|
||||
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>退出实训</a>");
|
||||
}$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
|
||||
// 保存版本库代码
|
||||
var fileUpdateUrl = $("#current_repository_path").html();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>',
|
||||
url: fileUpdateUrl,
|
||||
data:{ content: $('#challenge-answer-edit-small').val()},
|
||||
success: function(data){
|
||||
if(data.success == "success"){
|
||||
|
|
@ -191,31 +199,39 @@
|
|||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
nEvalInfo.show();
|
||||
//nHtmlContent.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
// test_sets 公开测,hide_test_sets 隐藏测试集
|
||||
var html = bt('t:exec_results_1',{
|
||||
"test_sets": eval('[' + data.test_sets + ']'),
|
||||
had_test_count: data.had_test_count,
|
||||
test_sets_count: data.test_sets_count,
|
||||
had_passed_testsests_error_count: data.had_passed_testsests_error_count,
|
||||
test_sets_hidden_count: data.test_sets_hidden_count,
|
||||
test_sets_public_count: data.test_sets_public_count,
|
||||
had_passed_testsests_hidden_count: data.had_passed_testsests_hidden_count,
|
||||
had_passed_testsests_public_count: data.had_passed_testsests_public_count,
|
||||
final_score: data.final_score,
|
||||
latest_output: data.latest_output,
|
||||
language: data.language
|
||||
});
|
||||
$("#game_test_set_results").html(html);
|
||||
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
|
||||
code_evaluation(
|
||||
eval('[' + data.test_sets + ']'),
|
||||
data.had_test_count,
|
||||
data.test_sets_count,
|
||||
data.had_passed_testsests_error_count,
|
||||
data.test_sets_hidden_count,
|
||||
data.test_sets_public_count,
|
||||
data.had_passed_testsests_hidden_count,
|
||||
data.had_passed_testsests_public_count,
|
||||
data.final_score,
|
||||
data.latest_output,
|
||||
data.language
|
||||
);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
if(data.status == 2){
|
||||
clearInterval(cm);
|
||||
clearInterval(intId);
|
||||
var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon
|
||||
$("#user_grade").html(parseInt($("#user_grade").html()) + parseInt(data.final_score));
|
||||
console.log("############################################");
|
||||
console.log(data.score);
|
||||
console.log(data.tag_count);
|
||||
console.log($("#shixun_exp_<%=@game_challenge.id %>")[0]);
|
||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
|
||||
icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center");
|
||||
icon.find("a:last").attr("title", "已完成");
|
||||
if( data.had_done == 0 ) {
|
||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
||||
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
|
||||
|
|
@ -229,6 +245,11 @@
|
|||
}
|
||||
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
|
||||
$("#code_test").html(html); // 恢复评测
|
||||
if($("#code_estimate").children("a").html().trim() == "下一关"){
|
||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
||||
} else if($("#code_estimate").children("a").html().trim() == "退出实训"){
|
||||
$("#code_estimate").html("<a href='<%= shixun_path(@shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
|
||||
}
|
||||
}
|
||||
// 访问60次,即120s后后台还未改变状态即执行
|
||||
if(i == 60){
|
||||
|
|
@ -238,12 +259,10 @@
|
|||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
nEvalInfo.show();
|
||||
//nHtmlContent.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
|
||||
var html_1 = "实训云平台繁忙(繁忙等级:88)";
|
||||
$("#code_test").html(html);
|
||||
|
|
@ -253,13 +272,11 @@
|
|||
complete: function(XMLHttpRequest,status){if(status=='timeout'){
|
||||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
//nHtmlContent.show();
|
||||
nEvalInfo.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
ajaxTimeoutTest.abort();
|
||||
clearInterval(intId);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,55 +1,44 @@
|
|||
<%= javascript_include_tag "/codemirror/lib/matchbrackets" %>
|
||||
|
||||
<style type="text/css">
|
||||
.CodeMirror{line-height: 1.2; font-size: 14px}
|
||||
.cm-s-railscasts span.cm-error{background:none;color: #d4cfc9;}
|
||||
.CodeMirror-matchingbracket { color: #fff34d; }
|
||||
</style>
|
||||
|
||||
<form action="<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>" method="post" id="file_update_id" data-remote="true">
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="undis" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
// 自动完成
|
||||
// 自动完成
|
||||
var codeContents = $("#challenge-answer-edit-small").val(); // 获取版本库代码内容
|
||||
var changeCode = codeContents;// 修改代码的内容(初始化时,与版本库代码一致,便于判断)
|
||||
$(function(){
|
||||
loading = $("#ajax-indicator").children('span')[0]; // 加载中的html
|
||||
});
|
||||
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
|
||||
/* mode: {name: "text/x-c++src",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},*/ // 目前补全js是引入的javascript-hint,因此目前不能指定语言
|
||||
lineNumbers: true,
|
||||
theme: "railscasts",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
extraKeys: {"Ctrl-Q": "autocomplete"},
|
||||
autofocus: true,
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
||||
});
|
||||
editor_CodeMirror.on('change',function(cMirror){
|
||||
|
||||
var editor_CodeMirror = CodeMirror_fromTextArea("challenge-answer-edit-small");
|
||||
|
||||
editor_CodeMirror.on('change', function(cMirror){
|
||||
// get value right from instance
|
||||
$('#challenge-answer-edit-small').val(cMirror.getValue());
|
||||
changeCode = cMirror.getValue(); // 获取修改后的代码
|
||||
<% if @shixun.language == "Html" %>
|
||||
tpi_html_show();
|
||||
<% if @myshixun.shixun.language == "Html" %>
|
||||
tpi_html_show();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
|
||||
// 每10秒钟保存一次
|
||||
editor_CodeMirror.on('focus',function(cMirror){
|
||||
|
|
@ -75,107 +64,107 @@
|
|||
clearInterval(sh);
|
||||
});
|
||||
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// 设置版本库字体间距
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
$(document).ready(function(){
|
||||
// 设置codemirror的高度/宽度自适应
|
||||
editor_CodeMirror.setSize("auto","auto");
|
||||
|
|
@ -184,17 +173,17 @@
|
|||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
</script>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<div id="game_test_set_results" class="-flex -relative blacktab-inner"></div>
|
||||
<script id="t:exec_results_1" type="text/html">
|
||||
<div id="blacktab_con_1" class="" >
|
||||
|
||||
<! if(language == "Html") { !>
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
|
|
@ -33,7 +34,9 @@
|
|||
<div id="blacktab_con_2" class="<!= language == 'Html' ? 'undis' : '' !>" >
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="evaluating_ajax_loading"></div>
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="evaluating_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
<div class="-flex -scroll task-padding16" id="evaluating_contents">
|
||||
<! if(had_test_count != "0") { !>
|
||||
<! if(had_passed_testsests_error_count != "0") { !>
|
||||
|
|
@ -86,7 +89,9 @@
|
|||
<div id="blacktab_con_3" class="undis" >
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="info_ajax_loading"></div>
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="info_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
<div class="-flex -scroll task-padding16" id="evaluating_info">
|
||||
<! if(had_test_count != "0") { !>
|
||||
<! if(had_passed_testsests_error_count != "0") { !>
|
||||
|
|
@ -117,46 +122,54 @@
|
|||
</script>
|
||||
|
||||
<script>
|
||||
var bt = baidu.template;
|
||||
// test_sets:测试集;had_test_count:输出集的个数;test_sets_count:测试集的个数;had_passed_testsests_error_count:测试集报错数;test_sets_hidden_count:隐藏测试集的个数
|
||||
// test_sets_public_count:公开测试集的个人;had_passed_testsests_hidden_count:通过的隐藏集个数;had_passed_testsests_public_count:通过的公开测试集个数
|
||||
// final_score:最终得分;had_done:通过的是否是最后一关;latest_output:最新的输出;language:实训的语言
|
||||
$(function(){
|
||||
code_evaluation(
|
||||
[<%= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
'<%= @had_test_count %>',
|
||||
'<%= @test_sets_count %>',
|
||||
'<%= @had_passed_testsests_error_count %>',
|
||||
'<%= @test_sets_hidden_count %>',
|
||||
'<%= @test_sets_public_count %>',
|
||||
'<%= @had_passed_testsests_hidden_count %>',
|
||||
'<%= @had_passed_testsests_public_count %>',
|
||||
'<%= @final_score %>',
|
||||
[<%= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
'<%= @language %>'
|
||||
);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
});
|
||||
|
||||
|
||||
/* var bt = baidu.template;
|
||||
bt.LEFT_DELIMITER = '<!';
|
||||
bt.RIGHT_DELIMITER = '!>';
|
||||
bt.ESCAPE = false;
|
||||
$(function(){
|
||||
// console.log("<%#= @public_test_sets.join(',').html_safe %>");
|
||||
var html = bt('t:exec_results_1',{
|
||||
test_sets: [<%= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
test_sets: [<%#= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
// hide_test_sets: [<%#= @private_test_sets.html_safe unless @private_test_sets.blank? %>]
|
||||
had_test_count: '<%= @had_test_count %>',
|
||||
test_sets_count: '<%= @test_sets_count %>',
|
||||
had_passed_testsests_error_count: '<%= @had_passed_testsests_error_count %>',
|
||||
test_sets_hidden_count : '<%= @test_sets_hidden_count %>',
|
||||
test_sets_public_count: '<%= @test_sets_public_count %>',
|
||||
had_passed_testsests_hidden_count: '<%= @had_passed_testsests_hidden_count %>',
|
||||
had_passed_testsests_public_count: '<%= @had_passed_testsests_public_count %>',
|
||||
final_score: '<%= @final_score %>',
|
||||
had_done: '<%= @had_done %>',
|
||||
latest_output: [<%= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
language: '<%= @language %>'
|
||||
had_test_count: '<%#= @had_test_count %>',
|
||||
test_sets_count: '<%#= @test_sets_count %>',
|
||||
had_passed_testsests_error_count: '<%#= @had_passed_testsests_error_count %>',
|
||||
test_sets_hidden_count : '<%#= @test_sets_hidden_count %>',
|
||||
test_sets_public_count: '<%#= @test_sets_public_count %>',
|
||||
had_passed_testsests_hidden_count: '<%#= @had_passed_testsests_hidden_count %>',
|
||||
had_passed_testsests_public_count: '<%#= @had_passed_testsests_public_count %>',
|
||||
final_score: '<%#= @final_score %>',
|
||||
had_done: '<%#= @had_done %>',
|
||||
latest_output: [<%#= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
language: '<%#= @language %>'
|
||||
}
|
||||
);
|
||||
$("#game_test_set_results").html(html);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
// 公开的测试集允许展开与隐藏
|
||||
function toggle_test_case(t_case, id){
|
||||
if(true){
|
||||
var nTest = $("#test_case_"+id).prev(".-task-ces-top").children("i:first-child"); //图标节点
|
||||
if (nTest.hasClass("fa-caret-down")){
|
||||
nTest.addClass("fa-caret-right");
|
||||
nTest.removeClass("fa-caret-down");
|
||||
}else if( nTest.hasClass("fa-caret-right") ){
|
||||
nTest.addClass("fa-caret-down");
|
||||
nTest.removeClass("fa-caret-right");
|
||||
}
|
||||
$("#test_case_"+id).toggle();
|
||||
}
|
||||
}
|
||||
function g_new(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=3;i++){
|
||||
|
|
@ -171,14 +184,5 @@
|
|||
* addClassName---------------点击tab需要添加的样式类
|
||||
* item-----------------------点击的当前tab元素
|
||||
* */
|
||||
function check_tab(allClassName,addClassName,item){
|
||||
//点击tab添加样式
|
||||
$("."+allClassName).removeClass(addClassName);
|
||||
$(item).addClass(addClassName);
|
||||
//获取当前点击的tab的索引位置
|
||||
var index=$(item).index()+1;
|
||||
//显示或隐藏对应的内容块
|
||||
$("#"+allClassName+"_"+index).siblings().addClass("undis");
|
||||
$("#"+allClassName+"_"+index).removeClass("undis");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">背景知识</a>
|
||||
</li>
|
||||
<% unless @game_challenge.answer.blank? %>
|
||||
<li id="tab_nav_3">
|
||||
<li id="tab_nav_3" onclick="open_answer('<%= @game.identifier %>', '<%= @myshixun.identifier %>')">
|
||||
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">参考答案</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
@ -63,15 +63,15 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="-layout-h -padding-h-16 -horizontal -footer-left pr">
|
||||
<div class="-layout-h -padding-h-16 -horizontal -footer-left">
|
||||
<ul class="-task-ml80">
|
||||
<%= render :partial => "games/shixun_comment_block" %>
|
||||
<li class="fl mt10 ml15"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
|
||||
<li class="fl mt10 ml20"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
|
||||
<li class="fl ml20 mt15">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise()" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise('<%= @game_challenge.id %>', '<%= @game_challenge.class %>')" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<i class="fa fa-thumbs-up font-20 mr3 <%= @praise.nil? ? "" : "color-light-green" %>" alt="赞" ></i><span class="font-12 font-bd" id="game_praise_count"><%= @praise_count %></span>
|
||||
</span>
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread()" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread('<%= @game_challenge.id %>')" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<i class="fa fa-thumbs-down font-20 mr3 <%= @tread.nil? ? "" : "color-orange" %>" ></i><span class="font-12 font-bd" id="game_tread_count"><%= @tread_count %></span>
|
||||
</span>
|
||||
</li>
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
<% if @st != 0 %>
|
||||
<!-- 单选多选题 -->
|
||||
<%= render :partial => "games/choice_question" %>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<!-- 编程题 -->
|
||||
<div class="-layout -stretch -fit -vertical centerH">
|
||||
<div class="-layout -vertical -flex -relative -bg-black -flex-basic70" id="games_repository_contents" style="overflow:hidden;">
|
||||
|
|
@ -120,90 +120,12 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
//拖拽增加js
|
||||
$(function(){
|
||||
var doc = $(document);
|
||||
var lab = $(".b-label");
|
||||
var cen = $(".h-center");
|
||||
var nextW2,nextW1;
|
||||
var dragging = false;
|
||||
var flag = false;
|
||||
var wrapWidth;
|
||||
var wrapHeight;
|
||||
lab.bind('mousedown',function(){
|
||||
dragging = true;
|
||||
leftOffset = $(".labelN").offset().left;
|
||||
wrapWidth = $(".labelN").width();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
cen.bind('mousedown',function(){
|
||||
flag = true;
|
||||
topOffset = $(".centerH").offset().top;
|
||||
wrapHeight = $(".centerH").height();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
doc.bind('mousemove',function(e){
|
||||
function error_correction_pop(){
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'games/send_error_pop') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
||||
$("#popupWrap").addClass("user_bg_shadow");
|
||||
};
|
||||
|
||||
$(".-brother").show();// 代码行的遮罩显示
|
||||
if(dragging) {
|
||||
clickX = e.pageX;
|
||||
|
||||
if(clickX > leftOffset+300&&clickX<leftOffset+1600) {
|
||||
//console.log(1);
|
||||
lab.css('left', clickX - 7 - leftOffset + 'px');
|
||||
lab.prev().width( clickX-leftOffset + 'px');
|
||||
nextW2 = clickX-leftOffset;
|
||||
lab.next().width( wrapWidth - nextW2 + 'px');
|
||||
//console.log(lab.next().width());
|
||||
} else {
|
||||
lab.css('left', '0px');
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
clickY = e.pageY;
|
||||
if(clickY > topOffset+100) {
|
||||
cen.css('top', clickY - 7 - topOffset + 'px');
|
||||
cen.prev().height( clickY-topOffset + 'px');
|
||||
nextW1 = clickY-topOffset;
|
||||
cen.next().height( wrapHeight - nextW1 + 'px');
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 50;
|
||||
$("#game_webssh").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
// return h;
|
||||
|
||||
|
||||
console.log( $("#game_webssh").find($contentDocument));
|
||||
// console.log($("#term").height());
|
||||
// $("#term").find(".xterm-viewport").css("min-height", h);
|
||||
// $("#term").find(".xterm-viewport").css("max-height", h);
|
||||
// console.log(1);
|
||||
// console.log($("#game_webssh").find(".xterm-viewport"));
|
||||
} else {
|
||||
cen.css('top', '0px');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
doc.mouseup(function(e) {
|
||||
flag = false;
|
||||
dragging = false;
|
||||
e.cancelBubble = true;
|
||||
$(".-brother").hide(); // 代码行的遮罩隐藏
|
||||
});
|
||||
})
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* var myMirror = $("#game_answer_show")[0];
|
||||
var myCodeMirror = CodeMirror(myMirror, {
|
||||
value: $("#hidden_game_answer").text(),
|
||||
mode: "<%#= @language %>",
|
||||
readOnly: "nocursor", //只读
|
||||
//cursorBlinkRate: -1, //隐藏光标
|
||||
autofocus: true,
|
||||
border: 0
|
||||
});*/
|
||||
$(document).ready(function() {
|
||||
editormd.loadKaTeX(function() {
|
||||
var wordsView;
|
||||
|
|
@ -223,84 +145,8 @@ $(function(){
|
|||
sequenceDiagram: true // 默认不解析
|
||||
});
|
||||
});
|
||||
/* myCodeMirror.setSize("auto", "auto");//设置版本库codemirror的高度
|
||||
$("#game_answer_show").find(".CodeMirror-scroll").css("margin-bottom", 0);
|
||||
$("#game_answer_show" ).children(".CodeMirror").css("line-height", 1.2);
|
||||
$("#game_answer_show").children().css("border", 0);*/
|
||||
/* // 设置图片最大宽度不能超出边框
|
||||
$('#task_pass_contents').find('img').css("max-width", "100%");*/
|
||||
|
||||
});
|
||||
$("#tab_nav_3").click(function(){
|
||||
$.ajax({
|
||||
url: "<%= answer_myshixun_game_path(@game, :myshixun_id => @myshixun) %>",
|
||||
dataType: "script"
|
||||
});
|
||||
});
|
||||
function error_correction_pop(){
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'games/send_error_pop') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
||||
$("#popupWrap").addClass("user_bg_shadow");
|
||||
};
|
||||
|
||||
// 点赞/取消点赞功能
|
||||
var praiseStatus = <%= @praise.nil? ? false : true %>; // 是否点赞
|
||||
var treadStatus = <%= @tread.nil? ? false : true %>; // 是否踩
|
||||
var h = true;
|
||||
function game_praise(){
|
||||
if(treadStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => @game_challenge.class}) %>',
|
||||
data: {horizontal: h, game_praise: true},
|
||||
success:function(data){
|
||||
h = !h;
|
||||
var praise_count = $("#game_praise_count");
|
||||
if(data.praise){
|
||||
praiseStatus = true; //已赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").addClass("color-light-green");
|
||||
$("#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("title", "点赞")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 踩/取消踩功能
|
||||
var d = true;
|
||||
function game_tread(){
|
||||
if(praiseStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => "ChallengeTread"}) %>',
|
||||
data: {horizontal: d, game_praise: true},
|
||||
success:function(data){
|
||||
d = !d;
|
||||
var tread_count = $("#game_tread_count");
|
||||
if(data.praise){
|
||||
treadStatus = true; // 取消踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").addClass("color-orange");
|
||||
$("#game_tread").attr("title", "取消踩")
|
||||
}else{
|
||||
treadStatus = false; // 已踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").removeClass("color-orange");
|
||||
$("#game_tread").attr("title", "踩")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reply_to_dis(id, name){
|
||||
$("#comment_news").attr("placeholder", "回复"+name+":");
|
||||
$("#dis_reply_id").val(id);
|
||||
$("#comment_news").focus();
|
||||
}
|
||||
</script>
|
||||
|
|
@ -22,6 +22,19 @@
|
|||
<a class="fr" title="未解锁"><i class="fa fa-lock fr font-18 mt5 color-grey w20_center" ></i></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div style="display: flex;" class="with80 ml30">
|
||||
<% if game.try(:status) == 0 || game.try(:status) == 1 || game.try(:status) == 3 %>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="ml5"><%= challenge.score %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="ml5"><%= challenge.score %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="ml5"><%= challenge.challenge_tags.count %></span></span>
|
||||
<% elsif game.try(:status) == 2 %>
|
||||
<% final_score = (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : game.final_score.to_i %>
|
||||
<% gold_score = @myshixun.shixun.status <= 1 ? 0 : (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) %>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="color-light-green mr5">+<%= final_score %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="<%= gold_score < 0 ? "u-color-light-red" : "color-light-green" %> mr5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="color-light-green mr5">+<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : challenge.challenge_tags.count %></span></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,14 @@
|
|||
<li id="codetab_nav_1" class="blacktab_hover" onclick="HoverLi_new(1);">
|
||||
<a href="javascript:void(0);" class="tab_type tab_color" >代码</a>
|
||||
</li>
|
||||
<li id="codetab_nav_2">
|
||||
<li id="codetab_nav_2" data-tab="2" class="add-webssh">
|
||||
<% if @myshixun.shixun.try(:webssh) %>
|
||||
<a href="javascript:void(0);" class="tab_type tab_color" >命令行</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li id="codetab_nav_add" class="undis c_white">
|
||||
<a href="javascript:void(0);" class="tab_type tab_color">+</a>
|
||||
</li>
|
||||
<div class="fr mt5 -horizontal">
|
||||
<% if @path == @game.challenge.path.try(:strip) %>
|
||||
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= reset_original_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本文件中修改的内容将丢失<br />是否确定重新加载初始代码');" title="恢复初始代码"><i class="fa fa-rotate-left font-18 mr5"></i></a>
|
||||
|
|
@ -25,9 +28,9 @@
|
|||
</div>
|
||||
<div class="-flex -relative">
|
||||
<div class="fit">
|
||||
<div class="-layout-v -fit loading-center undis" id="coding_ajax_loading">
|
||||
<!-- <div class="-layout-v -fit loading-center undis" id="coding_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="-layout-v -fit" id="coding_area">
|
||||
<div class="-flex">
|
||||
<div class="content-editor-inner">
|
||||
|
|
@ -46,63 +49,102 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="codetab_con_2" class="undis -relative">
|
||||
<div class="-flex -relative">
|
||||
<div class="fit">
|
||||
<div class="-layout-v -fit loading-center undis" id="coding_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
<div class="-layout-v -fit" id="coding_area">
|
||||
<div class="-flex">
|
||||
<div class="content-editor-inner" id="game_webssh">
|
||||
<%#= render :partial => 'games/game_webssh' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="codetab_con_2" class="undis -relative"></div>
|
||||
<div id="current_repository_path" class="undis"><%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %></div>
|
||||
<script>
|
||||
$(function(){
|
||||
LoadingWebssh();
|
||||
});
|
||||
var H = 2;
|
||||
function g_l(o){return document.getElementById(o);}
|
||||
function HoverLi_new(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
g_l('codetab_nav_'+i).className='blacktab_nomal';
|
||||
g_l('codetab_con_'+i).className='undis';
|
||||
console.log("n:" + n);
|
||||
for(var i=1;i<=H;i++){
|
||||
$('#codetab_nav_'+i).removeClass('blacktab_hover');
|
||||
$('#codetab_nav_'+i).addClass('blacktab_nomal');
|
||||
$('#codetab_con_'+i).hide();
|
||||
|
||||
}
|
||||
if(n==2){
|
||||
$("#games_repository_contents").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
$("#-bg-change-color").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
}else{
|
||||
if(n==1){
|
||||
$("#games_repository_contents").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
$("#-bg-change-color").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
$('#codetab_nav_add').addClass("undis");
|
||||
}else{
|
||||
$("#games_repository_contents").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
$("#-bg-change-color").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
$('#codetab_nav_add').removeClass("undis");
|
||||
}
|
||||
g_l('codetab_con_'+n).className='dis -relative';
|
||||
g_l('codetab_nav_'+n).className='blacktab_hover';
|
||||
$('#codetab_con_'+n).show();
|
||||
$('#codetab_nav_'+n).addClass('blacktab_hover');
|
||||
};
|
||||
|
||||
<% if @myshixun.shixun.try(:webssh) %>
|
||||
$('#codetab_nav_2').on("click", function(){
|
||||
HoverLi_new(2);
|
||||
});
|
||||
<% end %>
|
||||
|
||||
$('#codetab_nav_add').click(function(){
|
||||
//console.log(1);
|
||||
if($(".add-webssh").length < 5){
|
||||
H += 1;
|
||||
$(this).before("<li id=\"codetab_nav_"+H+"\" data-tab="+ H +" class=\"add-webssh\">"+
|
||||
"<a href=\"javascript:void(0);\" class=\"tab_type tab_color \" onclick='HoverLi_new("+H+")'>命令行</a>"+
|
||||
"<span>×</span>" +
|
||||
"</li>");
|
||||
$("#games_repository_contents").append("<div id=\"codetab_con_"+H+"\" class=\"undis -relative\">"+
|
||||
|
||||
|
||||
"</div>");
|
||||
console.log("##################################"+$(".add-webssh").length);
|
||||
if($(".add-webssh").length == 5){
|
||||
$(this).hide();
|
||||
}
|
||||
LoadingWebssh();
|
||||
|
||||
|
||||
$('#blacktab_nav').find("li").click(function(){
|
||||
//console.log($(this).attr("class"));
|
||||
if($(this).attr("id")==$("#codetab_nav_add").attr("id")){
|
||||
return;
|
||||
}
|
||||
if($(this).attr("id")=="codetab_nav_"+H+""){
|
||||
|
||||
HoverLi_new(H);
|
||||
}
|
||||
|
||||
});
|
||||
$('.add-webssh').find("span").click(function(){
|
||||
$("#codetab_con_"+$(this).parent().attr("data-tab")).hide();
|
||||
$('#codetab_nav_add').show();
|
||||
console.log(1111111111111111111111111111);
|
||||
var index = $($(this).parent().prevAll()[0]).attr("data-tab");
|
||||
$(this).parent().remove();
|
||||
HoverLi_new(index);
|
||||
});
|
||||
HoverLi_new(H);
|
||||
}
|
||||
});
|
||||
|
||||
function LoadingWebssh(){
|
||||
$.ajax({
|
||||
url: "<%= open_webssh_myshixun_path(@myshixun) %>",
|
||||
success: function(data){
|
||||
if(data.error){
|
||||
return;
|
||||
}else{
|
||||
var h = $("#games_repository_contents").height() - 40;
|
||||
var rows = parseInt(h / 18);
|
||||
// 测试版
|
||||
var html = "<iframe src='<%= Redmine::Configuration['webssh'] %>/?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "&Gameid=" + data.game_id + "'" + " style='width:100%;border:0;' scrolling='no' id='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
var html = "<iframe src='<%= Redmine::Configuration['webssh'] %>/?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "&Gameid=" + data.game_id + "&rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
// 本地版
|
||||
var html_local ="<iframe src='http://127.0.0.1:9527?Host=106.75.96.108&Port=40054&Username=root&Password=123123&Gameid=" +data.game_id + "'" + " style='width:100%;border:0;' scrolling='no' id='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
$("#codotab_con_2").html(html);
|
||||
//var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
|
||||
// $("#game_webssh").css("min-height", h);
|
||||
HoverLi_new(2);
|
||||
// console.log( $("#game_webssh").contentDocument.body.height());
|
||||
var html_local ="<iframe src='http://127.0.0.1:9527?Host=106.75.96.108&Port=40054&Username=root&Password=123123&Gameid=" +data.game_id + "&rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
// $("#LazyLoading").remove();
|
||||
$("#codetab_con_"+H).html(html);
|
||||
$(".game_webssh").css("min-height", h);
|
||||
// HoverLi_new(2);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -3,5 +3,5 @@
|
|||
<% else %>
|
||||
$("#games_repository_contents").html('<%= escape_javascript(render :partial => 'games/repository') %>');
|
||||
<% end %>
|
||||
$("#coding_area").show();
|
||||
//$("#coding_area").show();
|
||||
$("#coding_ajax_loading").css("display", "none");
|
||||
|
|
@ -19,71 +19,4 @@
|
|||
notice_sure_box("实训更新啦,系统已自动为您重置");
|
||||
<% end %>
|
||||
});
|
||||
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
|
||||
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
|
||||
var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域
|
||||
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
|
||||
var nMove = $(".h-center");
|
||||
|
||||
/* --------------------------------版本库的放大与缩小---------------------------------------------*/
|
||||
function repository_extend_and_zoom(){
|
||||
if(control == 0){
|
||||
nGameRes.addClass("-flex-basic100");
|
||||
nGameEva.addClass("-flex-basic0");
|
||||
nRIcon.addClass("fa-compress");
|
||||
nRIcon.removeClass("fa-arrows-alt");
|
||||
nMove.hide();
|
||||
control = 1;
|
||||
}else if(control == 1){
|
||||
nGameRes.removeClass("-flex-basic100");
|
||||
nGameEva.removeClass("-flex-basic0");
|
||||
nRIcon.removeClass("fa-compress");
|
||||
nRIcon.addClass("fa-arrows-alt");
|
||||
nMove.show();
|
||||
control = 0;
|
||||
}
|
||||
editor_CodeMirror.setSize("auto", "auto");
|
||||
var h = nGameRes.height() - $("#top_repository").height() - 50;
|
||||
nCode.css("min-height", h);
|
||||
}
|
||||
|
||||
/* --------------------------------测评的扩大与缩小---------------------------------------------*/
|
||||
function valuation_extend_and_zoom(){
|
||||
if(control_1 == 0){
|
||||
nGameRes.addClass("-flex-basic0");
|
||||
nGameEva.addClass("-flex-basic100");
|
||||
nVIcon.removeClass("fa-expand");
|
||||
nVIcon.addClass("fa-compress");
|
||||
nMove.hide();
|
||||
control_1 = 1;
|
||||
}else if(control_1 == 1){
|
||||
nGameRes.removeClass("-flex-basic0");
|
||||
nGameEva.removeClass("-flex-basic100");
|
||||
nVIcon.addClass("fa-expand");
|
||||
nVIcon.removeClass("fa-compress");
|
||||
nMove.show();
|
||||
control_1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------点击全部任务向右侧展开-----------------------------------------*/
|
||||
$("#all_task_show").on("click", function(e){
|
||||
c = 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;
|
||||
});
|
||||
});
|
||||
// 列表区域阻止事件冒泡
|
||||
$("#all_task_index").on("click", function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
<% if params[:index].nil? %>
|
||||
clearInterval(cm); // tpi关闭耗时
|
||||
$("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>');
|
||||
<% if !@type.blank? || !params[:path].nil? %>
|
||||
$("#games_repository_contents").html('<%= escape_javascript(render :partial => 'games/repository') %>');
|
||||
<% else %>
|
||||
$("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>');
|
||||
<% end %>
|
||||
$("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>');
|
||||
$("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>');
|
||||
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<ul class="sy_classlist clearfix">
|
||||
<ul class="sy_classlist clearfix" style="border: none">
|
||||
<input class="magic-checkbox" type="checkbox" name="layout" id="homework_bank_all_select" class="fl">
|
||||
<label for="homework_bank_all_select" class="fl mr15">全选</label>
|
||||
<div class="fl resource_btns_bottom pt5">
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<label for="shixun_input_<%= shixun.id %>"></label>
|
||||
<%= link_to shixun.name, shixun_path(shixun), :class => "edu-info-dark task-hide mt3", :target => "_blank" %>
|
||||
</td>
|
||||
<td><%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "edu-txt-w140 mt3 task-hide" %></td>
|
||||
<td><%= link_to shixun.owner.try(:show_real_name), user_path(shixun.owner), :class => "edu-txt-w140 mt3 task-hide" %></td>
|
||||
<td><%= shixun.myshixuns.count %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<% if params[:is_search] %>
|
||||
$("#new_shixun_homework_list").html("<%= j(render :partial => 'homework_common/new_shixun_homework_list') %>");
|
||||
$("#new_shixun_homework_list").html("<%= j(render :partial => 'homework_bank/new_shixun_homework_list') %>");
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_bank/shixuns') %>";
|
||||
pop_box_new(htmlvalue, 680, 454);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKCOMMON,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @ref_answer.nil? ? 0: @ref_answer.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKREFERENCEANSWER,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKCOMMON,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @ref_answer.nil? ? 0: @ref_answer.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKREFERENCEANSWER,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
|
||||
:owner_id => @homework.nil? ? 0: @homework.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKCOMMON,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
|
||||
:owner_id => @ref_answer.nil? ? 0: @ref_answer.id,
|
||||
:owner_type => OwnerTypeHelper::HOMEWORKREFERENCEANSWER,
|
||||
:width => '89.7%',
|
||||
:width => '90%',
|
||||
:height => 200,
|
||||
:minHeight=>200,
|
||||
:class => 'talk_text fl',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<div class="mh360">
|
||||
<table class="edu-pop-table color-grey edu-txt-center table-pa5" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -21,7 +22,7 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<div class="clearfix fr mt15">
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="new_shixun_homework();">选择</a>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<div class="newMain clearfix">
|
||||
<div class="edu-class-container">
|
||||
<h3>K8S开启容器</h3>
|
||||
<ul>
|
||||
<li>创建webssh容器名:<%= link_to "huang-01", {:controller => "kubernete", :action => "exec_pod", :name => 1, :type => "webssh"} %></li>
|
||||
<li>创建jdk容器名:<%= link_to "huang-02", {:controller => "kubernete", :action => "exec_pod", :name => 2, :type => "jdk"} %></li>
|
||||
<li>创建容器名:<%= link_to "huang-03", {:controller => "kubernete", :action => "exec_pod", :name => 3, :type => "webssh"} %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
</li>
|
||||
|
||||
<li class="clearfix" id="sy_010">
|
||||
<a href="<%=course_statistics_course_path(@course) %>" class="fl ml15 ">统计</a>
|
||||
<a href="<%= course_statistics_course_path(@course) %>" class="fl ml15 ">统计</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -30,7 +30,12 @@
|
|||
<i class="fa fa-gamepad color-light-green font-20 pl15 pr10 pt5" aria-hidden="true"></i><span>实训</span>
|
||||
<ul class="color-grey">
|
||||
<li><%= link_to "我的实训", shixuns_user_path(User.current), :target => "_blank" %></li>
|
||||
<li><%= link_to "新建实训", new_shixun_path, :target => "_blank" %></li>
|
||||
<!-- <li><%#= link_to "新建实训", new_shixun_path, :target => "_blank" %></li>-->
|
||||
<% if User.current.mail.blank? %>
|
||||
<li><a href="javascript:void(0)" onclick="shixun_valication()">新建实训</a></li>
|
||||
<% else %>
|
||||
<li><%= link_to "新建实训", new_shixun_path, :target => "_blank" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="list">
|
||||
|
|
@ -44,6 +49,7 @@
|
|||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
resizeTop();
|
||||
$(".sidebar").hover(function() {
|
||||
$(this).css({
|
||||
width:'50px'
|
||||
|
|
@ -73,10 +79,18 @@
|
|||
|
||||
//页面缩放时调整整个页面和左侧导航栏的距离
|
||||
$(window).resize(function() {
|
||||
resizeTop();
|
||||
});
|
||||
function resizeTop(){
|
||||
if($(window).width()<1300){
|
||||
$(".newContainer").css("padding-left","50px");
|
||||
}else{
|
||||
$(".newContainer").css("padding-left","0px");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 新建实训
|
||||
function shixun_valication(){
|
||||
notice_box_redirect('<%= security_settings_path %>', '开启实训,请先绑定邮箱');
|
||||
}
|
||||
</script>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div id="Container" class="panel-content clearfix">
|
||||
<div id="Container" class="panel-content clearfix user_bg_shadow">
|
||||
<div class="panel-user-left fl">
|
||||
<ul class="panel-user-leftnav">
|
||||
<h3 class="mb15 ml15 mt15">账户管理</h3>
|
||||
|
|
|
|||
|
|
@ -51,5 +51,8 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span>载入中...</span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -36,17 +36,17 @@
|
|||
<% when 6 %>
|
||||
<%= @sub_type == 1 ? "单位列表" :"单位部门列表" %>
|
||||
<% when 7 %>
|
||||
<%= @sub_type == 1 ? "用户列表" :"适用授权列表" %>
|
||||
<%= @sub_type == 1 ? "用户列表" :"试用授权列表" %>
|
||||
<% when 8 %>
|
||||
消息
|
||||
<% when 9 %>
|
||||
留言
|
||||
<% when 10 %>
|
||||
<%= @sub_type == 1 ? "实名认证":(@sub_type == 2? "适用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"全部实训发布":(@sub_type == 6?"课程实训发布":"职业认证")))))%>
|
||||
<%= @sub_type == 1 ? "实名认证":(@sub_type == 2? "试用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"全部实训发布":(@sub_type == 6?"课程实训发布":"职业认证")))))%>
|
||||
<% when 11 %>
|
||||
工程认证+
|
||||
<% when 12 %>
|
||||
其他
|
||||
<%= @sub_type == 1 ?"专业列表" : "实训适用课程列表" %>
|
||||
<% end %>
|
||||
</span>
|
||||
</p>
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li class="fl edu-admin-nav-li "><a href="javascript:void(0);" class="edu-admin-nav-a">工程认证+</a></li>
|
||||
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 11 %>" style="width: 120px"><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a>
|
||||
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 12 %>" style="width: 120px"><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a>
|
||||
<ul class="edu-admin-nav-inner">
|
||||
<li style="width: 120px"><%= link_to "专业列表",profession_managements_path %></li>
|
||||
<li style="width: 120px"><%= link_to "实训适用课程列表", applicable_course_managements_path %></li>
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome','css/taskstyle', 'css/project','css/popup','repository','css/gantt','css/cssPlus-v.0.2-build', 'css/edu-common','css/edu-public', 'css/edu-popup', 'css/edu-tooltipster' %>
|
||||
<%= javascript_include_tag 'edu/application' %>
|
||||
<%= javascript_include_tag 'edu/application', 'edu/edu_tpi' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body onload="prettyPrint();">
|
||||
<body onload="setupAjaxIndicator();">
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="page -layout-v -fit ">
|
||||
|
|
@ -52,11 +52,12 @@
|
|||
</div>
|
||||
<%= yield %>
|
||||
</div>
|
||||
<!--<div id="ajax-indicator" style="display:none;">
|
||||
<span><%#= l(:label_loading) %></span>
|
||||
|
||||
<div id="ajax-indicator-base" style="display:none;">
|
||||
<!--<span><embed src='/images/bigdata/loading2.svg' /></span>-->
|
||||
</div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>-->
|
||||
<!--<div id="ajax-modal" style="display:none;"></div>-->
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common', "css/edu-public", 'css/taskstyle', 'css/edu-subject', 'css/moduel', 'css/font-awesome', 'css/edu-tooltipster', 'css/magic-check' %>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<%= javascript_include_tag 'application', 'cookie',"avatars", 'header','prettify','attachments','edu/application','edu/subject' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
@ -43,8 +46,5 @@
|
|||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<%= javascript_include_tag 'application', 'cookie',"avatars", 'header','prettify','attachments','edu/application' %>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
<div style="width:400px" class="task-popup">
|
||||
<div class="task-popup-title clearfix ">
|
||||
<h3 class="fl color-grey mt10 ml5">更改为</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="mt10 ml10">
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="task-height-40 panel-box-sizing fl edu-txt-w320 ml30" style="padding: 2px 5px" />
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="schools_list" class="mt10 mb20 ml40 mr40">
|
||||
<%= render :partial => "managements/update_department_form", :locals => {:department => department, :edit_id => edit_id} %>
|
||||
</div>
|
||||
<span id="choose_courses_notice" class="c_red ml35"></span>
|
||||
<div class="task-popup-submit clearfix ml25">
|
||||
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
|
||||
<a href="javascript:void(0);" onfocus='this.blur();' onclick="department_submit();" class="task-btn task-btn-blue fr" >确定</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
});
|
||||
$("#search_course_input").on('input',function(e){
|
||||
throttle(search_courses, window, e);
|
||||
});
|
||||
function department_submit() {
|
||||
var checkboxs = $("input[name='department_id[]']:checked");
|
||||
if(checkboxs.length == 0) {
|
||||
$("#choose_courses_notice").text("请选择单位");
|
||||
} else{
|
||||
$("#choose_courses_notice").text("");
|
||||
$("#schools_list_form").submit();
|
||||
hideModal();
|
||||
}
|
||||
}
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_courses(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'managements', :action => 'all_department') %>'+'?search='+ e.target.value+'&department_id=<%= edit_id %>',
|
||||
type:'get',
|
||||
data: {is_observe:true},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
||||
complete: function(){ $(this).removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<div style="width:400px" class="task-popup">
|
||||
<div class="task-popup-title clearfix ">
|
||||
<h3 class="fl color-grey mt10 ml5">更改为</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="mt10 ml10">
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="task-height-40 panel-box-sizing fl edu-txt-w320 ml30" style="padding: 2px 5px" />
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="schools_list" class="mt10 mb20 ml40 mr40">
|
||||
<%= render :partial => "managements/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
|
||||
</div>
|
||||
<span id="choose_courses_notice" class="c_red"></span>
|
||||
<div class="task-popup-submit clearfix ml25">
|
||||
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
|
||||
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="task-btn task-btn-blue fr" >确定</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
});
|
||||
$("#search_course_input").on('input',function(e){
|
||||
throttle(search_courses, window, e);
|
||||
});
|
||||
function school_submit() {
|
||||
var checkboxs = $("input[name='school_id[]']:checked");
|
||||
if(checkboxs.length == 0) {
|
||||
$("#choose_courses_notice").text("请选择单位");
|
||||
} else{
|
||||
$("#choose_courses_notice").text("");
|
||||
$("#schools_list_form").submit();
|
||||
hideModal();
|
||||
}
|
||||
}
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_courses(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'managements', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%= edit_id %>',
|
||||
type:'get',
|
||||
data: {is_observe:true},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
||||
complete: function(){ $(this).removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -4,20 +4,106 @@
|
|||
<th width="9%">序号</th>
|
||||
<th width="30%" class="edu-txt-left">课程名称</th>
|
||||
<th width="30%" class="edu-txt-left">专业名称</th>
|
||||
<th width="15%"class="eud-pointer">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="15%" class="eud-pointer">创建时间<i class="fa fa-long-arrow-down %> color-light-green ml5"></i></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @majorcourse.each_with_index do |majorcourse,index|%>
|
||||
<tr>
|
||||
<td><%= majorcourse.course_list_id%></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% count = 0 %>
|
||||
<% @courselist.each_with_index do |courselist,index|%>
|
||||
<tr>
|
||||
<td>
|
||||
<% count = ((@page - 1) * @limit) + index + 1 %>
|
||||
<%= count %>
|
||||
</td>
|
||||
<td class="edu-txt-left create" id="<%= courselist.id %>">
|
||||
<%= courselist.name %>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%= format_time courselist.created_at %>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:void(0)" onclick="add_major('<%= courselist.id %>')" >添加专业</a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<% get_course_list_major(courselist.id).each_with_index do |smc, j| %>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td class="edu-txt-left">
|
||||
</td>
|
||||
<td class="edu-txt-left" >
|
||||
<%= smc.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= format_time courselist.created_at %>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="text-align:center;" class="new_expand">
|
||||
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @courselist_pages, @courselist_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function add_major(courselist_id){
|
||||
var htmlvalue ='<div style="width:400px" class="task-popup"><div class="task-popup-title clearfix "><h3 class="fl color-grey">适用课程添加所属专业</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5 "></i></a>'+
|
||||
'<select class="mt20 ml75 mb10" id="major" name="major_id">' +
|
||||
'<option value="0" selected="selected">请选择支撑实训的专业名称</option>'+
|
||||
'<% @major.each do |major| %>'+
|
||||
'<option value="<%= major.id %>" ><%= major.name %></option>'+
|
||||
'<% end %>'+
|
||||
'</select>' +
|
||||
'<span class="color-orange fl none" style="margin-left: 17%;" id="new_major_name_notice">'+
|
||||
'<i class="fa fa-exclamation-circle mr5" ></i>'+
|
||||
'请先选择要支撑实训的专业名称</span>'+
|
||||
'<div class="cl"></div>' +
|
||||
'<div class="task-popup-submit clearfix ml25">' +
|
||||
'<a href="javascript:void(0);" class="task-btn fl pop_close mr10">取消</a>' +
|
||||
'<a href="javascript:void(0);" onclick="submit_new_major('+ courselist_id +');" class="task-btn task-btn-blue fr" >确定</a>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'</div>';
|
||||
pop_box_new(htmlvalue, 400, 160);
|
||||
};
|
||||
|
||||
function submit_new_major(courselist_id) {
|
||||
var major_id= $("select").find("option:selected").val();
|
||||
if(major_id != 0){
|
||||
$("#new_major_name_notice").html("请先选择要支撑实训的专业名称").hide();
|
||||
$.ajax({
|
||||
url: "/managements/add_major",
|
||||
data:{course_list_id:courselist_id,major_id:major_id},
|
||||
type: 'post',
|
||||
success: function(data){
|
||||
if(data.result == 0){
|
||||
$("#new_major_name_notice").html("该课程已属于本专业,请重新选择").show();
|
||||
} else{
|
||||
window.location.href = "<%= applicable_course_managements_path %>";
|
||||
hideModal();
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$("#new_major_name_notice").show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<th width="40%" class="edu-txt-left">实训套件名称</th>
|
||||
<th width="20%" class="edu-txt-left">单位</th>
|
||||
<th width="15%">创建者</th>
|
||||
<th >发布时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
|
||||
<th class="eud-pointer">发布时间<i class="fa fa-long-arrow-down color-light-green ml5"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -19,5 +19,4 @@
|
|||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<th width="8%">状态</th>
|
||||
<th width="20%" class="edu-txt-left">单位</th>
|
||||
<th width="8%">创建者</th>
|
||||
<th width="11%">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="11%" class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -25,13 +25,42 @@
|
|||
<td><%= format_time c_shixun.created_at %></td>
|
||||
<td class="class_shixun_delete">
|
||||
<% if c_shixun.status == 0 %>
|
||||
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= subject_path(c_shixun) %>', '确定要删除该实训套件吗?')">删除</a>
|
||||
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= subject_path(c_shixun) %>', '确定要删除该实训套件吗?')">删除</a>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
<span class="fr mr20 subject_hidden">
|
||||
<input type="checkbox" <%= c_shixun.hidden ? 'checked' : "" %> value="0" id="c_shixun_hidden_<%= c_shixun.id %>" name="hidden" class="ml-3 mr5 magic-checkbox">
|
||||
<label style="top:0px;padding-left: 19px;" for="c_shixun_hidden_<%= c_shixun.id %>">隐藏</label>
|
||||
<div class="undis"><%= c_shixun.id %></div>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</table>
|
||||
<script>
|
||||
// alert(window.location.href);
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= class_shixuns_managements_path %>",
|
||||
data: $("#class_shixuns_search").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$(".subject_hidden").on("click", 'input', function(ev){
|
||||
var id = $(ev.target).parent().find("div").html();
|
||||
$.ajax({
|
||||
url:"<%= update_subject_hidden_managements_path %>",
|
||||
dataType: "script",
|
||||
data:{subject_id: id}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,44 +1,45 @@
|
|||
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="9%">ID</th>
|
||||
<th width="20%" class="edu-txt-left">班级名称</th>
|
||||
<th width="4%">成员</th>
|
||||
<th width="4%">资源</th>
|
||||
<th width="4%">作业</th>
|
||||
<th width="4%">试卷</th>
|
||||
<th width="4%">私有</th>
|
||||
<th width="4%">模版</th>
|
||||
<th width="8%">状态</th>
|
||||
<th width="13%" class="edu-txt-left">创建者单位</th>
|
||||
<th width="11%">创建者</th>
|
||||
<th class="eud-pointer" width="11%">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
|
||||
<th>首页显示</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr>
|
||||
<td><%= course.id %></td>
|
||||
<td class="edu-txt-left"><a href=""><%= link_to course.name, school_on_search_path(course.name) %></a></td>
|
||||
<td><%= course.members.count %></td>
|
||||
<td><%= course.attachments.count %></td>
|
||||
<td><%= course.homework_commons.count%></td>
|
||||
<td><%= course.exercises.count %></td>
|
||||
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
|
||||
<td></td>
|
||||
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
|
||||
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
|
||||
<td> <%= link_to course.teacher.show_name, user_path(course.teacher) %></td>
|
||||
<td> <%= format_time(course.updatetime) %></td>
|
||||
<td class="operate"><span class="fr shixun_webssh">
|
||||
<input type="checkbox" value="0" class="ml-3 mr5 magic-checkbox" id="join_course_role_24">
|
||||
<label style="top:-14px;padding-left: 35px;" for="join_course_role_24"></label></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="9%">ID</th>
|
||||
<th width="20%" class="edu-txt-left">班级名称</th>
|
||||
<th width="4%">成员</th>
|
||||
<th width="4%">资源</th>
|
||||
<th width="4%">作业</th>
|
||||
<th width="4%">试卷</th>
|
||||
<th width="4%">私有</th>
|
||||
<th width="4%">模版</th>
|
||||
<th width="8%">状态</th>
|
||||
<th width="13%" class="edu-txt-left">创建者单位</th>
|
||||
<th width="11%">创建者</th>
|
||||
<th class="eud-pointer" width="11%">动态时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
|
||||
<th>首页显示</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr>
|
||||
<td><%= course.id %></td>
|
||||
<td class="edu-txt-left"><%= link_to course.name, course_path(course.id) %></a></td>
|
||||
<td><%= course.members.count %></td>
|
||||
<td><%= course.attachments.count %></td>
|
||||
<td><%= course.homework_commons.count%></td>
|
||||
<td><%= course.exercises.count %></td>
|
||||
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
|
||||
<td></td>
|
||||
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
|
||||
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
|
||||
<td> <%= link_to course.teacher.show_real_name, user_path(course.teacher) %></td>
|
||||
<td> <%= format_time(course.updatetime) %></td>
|
||||
<td>
|
||||
<input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
|
||||
<label style="top:-14px;padding-left: 35px;float:right;" for="join_course_role_<%= course.id %>"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="cl"></div>
|
||||
<div style="text-align:center;" class="new_expand">
|
||||
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
|
|
@ -51,10 +52,20 @@
|
|||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= classroom_classment_managements_path %>",
|
||||
data: {sx_order:sx_order},
|
||||
data: $("#class_publish_shixuns_search").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
$("input[name='homepage_show']").click(function(){
|
||||
var homepage_show_val = $(this).val();
|
||||
$.ajax({
|
||||
url:"<%= course_homepage_show_managements_path %>",
|
||||
data: {course_id: homepage_show_val},
|
||||
type: 'post',
|
||||
dateType: "script"
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@
|
|||
<tr>
|
||||
<th width="9%">ID</th>
|
||||
<th width="10%">层级</th>
|
||||
<th width="12%" class="edu-txt-left">学科门类</th>
|
||||
<th width="12%" class="edu-txt-left">学科门类</th>
|
||||
<th width="12%">一级学科</th>
|
||||
<th width="12%">专业名称</th>
|
||||
<th width="15%" class="edu-txt-left">课程名称</th>
|
||||
<th width="12%">创建者</th>
|
||||
<th width="10%" class="edu-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
<th>课堂模版</th>
|
||||
<th class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -20,13 +19,11 @@
|
|||
<td class="edu-txt-left"><%= syllabus.syllabus_discipline_category == '' ? "--" : syllabus.syllabus_discipline_category %></td>
|
||||
<td><%= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %></td>
|
||||
<td><%= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %></td>
|
||||
<td class="edu-txt-left"> <%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %></td>
|
||||
<td class="edu-txt-left">
|
||||
<%= link_to syllabus.title,syllabus_path(syllabus.id) %>
|
||||
</td>
|
||||
<td><%= link_to syllabus.user.show_name, user_path(syllabus.user) %></td>
|
||||
<td><%= format_time syllabus.created_at %></td>
|
||||
<td class="operate"><span class="fr shixun_webssh">
|
||||
<input type="checkbox" value="0" class="ml-3 mr5 magic-checkbox" id="join_course_role_24">
|
||||
<label style="top:-14px;padding-left: 45px;" for="join_course_role_24"></label>
|
||||
</span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
@ -39,4 +36,16 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= classroom_managements_path %>",
|
||||
data: $("#classroom").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
<th width="9%">序号</th>
|
||||
<th width="25%" class="edu-txt-left">部门名称</th>
|
||||
<th width="30%" class="edu-txt-left">单位名称</th>
|
||||
<th width="15%"class="eud-pointer">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width=""></th>
|
||||
<th width="15%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
<td><%= apply.id %></td>
|
||||
<td class="edu-txt-left"> <%= apply.name %></td>
|
||||
<td class="edu-txt-left"> <%= apply.school.name %></td>
|
||||
<td > <%= format_date(apply.created_at) %></td>
|
||||
<td><%= format_time apply.created_at %></td>
|
||||
<td class="center">
|
||||
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_departments', :id => apply.id }, :class => "application-default-link" ) %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_departments', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
<%= link_to( l(:label_approve), { :controller => 'managements', :action => 'approve_applied_departments', :id => apply.id }, :class => "application-default-link" ) %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'managements', :action => 'delete_applied_departments', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%= link_to '更改',all_department_managements_path(:department_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
@ -33,12 +33,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// var find=$("#shixun_Look_name").val();
|
||||
function myFunction(){
|
||||
if($("#shixun_Look_name").val()==""){
|
||||
$(".d-none").css("display","none");
|
||||
}else{
|
||||
$(".d-none").css("display","block");
|
||||
}
|
||||
}
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= depart_managements_path %>",
|
||||
data: $("#depart_search").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<th width="30%" class="edu-txt-left">部门名称</th>
|
||||
<th width="15%">用户数</th>
|
||||
<th width="15%">已认证职业</th>
|
||||
<th width="20%">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="20%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title=""></i></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -39,4 +39,15 @@
|
|||
$(".d-none").css("display","block");
|
||||
}
|
||||
}
|
||||
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= departments_managements_path %>",
|
||||
data: $("#department_search").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<th width="19%" class="edu-txt-left">详细地址</th>
|
||||
<th style="width: 6%;" >用户数</th>
|
||||
<th width="6%">部门数</th>
|
||||
<th width="15%"class="eud-pointer">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="15%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
<td><%= schools.id %></td>
|
||||
<td>
|
||||
<%= image_tag(schools.logo_link,width:40,height:40) %>
|
||||
|
||||
</td>
|
||||
<td class="edu-txt-left">
|
||||
<span>
|
||||
|
|
@ -49,12 +48,14 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
// var find=$("#shixun_Look_name").val();
|
||||
function myFunction(){
|
||||
if($("#shixun_Look_name").val()==""){
|
||||
$(".d-none").css("display","none");
|
||||
}else{
|
||||
$(".d-none").css("display","block");
|
||||
}
|
||||
}
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= departments_part_managements_path %>",
|
||||
data: $("#department_part_search").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<th width="12%" class="edu-txt-left">学科门类</th>
|
||||
<th width="12%" class="edu-txt-left">一级学科</th>
|
||||
<th width="28%" class="edu-txt-left">专业名称</th>
|
||||
<th width="15%"class="eud-pointer">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="15%"class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" ></i></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<td> <%= format_time syllabus.created_at %></td>
|
||||
<td class="operate edu-txt-left"><span class="fr shixun_webssh">
|
||||
<input type="checkbox" value="0" class="magic-checkbox" id="join_course_role_<%= syllabus.id%>">
|
||||
<label style="top:-3px;padding-left: 25px;" for="join_course_role_<%= syllabus.id%>">支撑实训</label>
|
||||
<label style="top:-3px;padding-left: 25px;" for="join_course_role_<%= syllabus.id %>">支撑实训</label>
|
||||
</span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
@ -36,4 +36,15 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".eud-pointer").on("click",function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= profession_managements_path %>",
|
||||
data: $("#profession").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
|
||||
<thead>
|
||||
<th width="10%">ID</th>
|
||||
<th class="table_Name_text" width="30%">实训名称</th>
|
||||
<th width="9%">ID</th>
|
||||
<th class="table_Name_text" >实训名称</th>
|
||||
<th width="8%">顶</th>
|
||||
<th width="8%">踩</th>
|
||||
<th width="8%">已通关</th>
|
||||
<th width="8%">已开启</th>
|
||||
<th width="8%">创建者</th>
|
||||
<th width="9%">已开启</th>
|
||||
<th width="9%">创建者</th>
|
||||
<th class="eud-pointer" width="11%">发布时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
|
||||
<th width="9%">操作</th>
|
||||
<th>首页显示</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @shixuns.each do |shixun| %>
|
||||
|
|
@ -28,6 +29,10 @@
|
|||
<td class="operate">
|
||||
<%= link_to "关闭", publish_shixuns_managements_path(:close => shixun.id), :class => "", :remote => true %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="homepage_show" value="<%= shixun.id %>" <%= shixun.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= shixun.id %>">
|
||||
<label style="top:-14px;" class="ml75" for="join_course_role_<%= shixun.id %>"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
@ -50,5 +55,14 @@
|
|||
data: {sx_order:sx_order},
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
$("input[name='homepage_show']").click(function(){
|
||||
var homepage_show_val = $(this).val();
|
||||
$.ajax({
|
||||
url:"<%= shixun_homepage_show_managements_path %>",
|
||||
data: {shixun_id: homepage_show_val},
|
||||
type: 'post',
|
||||
dateType: "script"
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
|
||||
<thead>
|
||||
<th width="10%">ID</th>
|
||||
<th class="table_Name_text" width="30%">实训名称</th>
|
||||
<th class="table_Name_text" width="25%">实训名称</th>
|
||||
<th width="15%">技术平台</th>
|
||||
<th width="5%">任务</th>
|
||||
<th width="10%">状态</th>
|
||||
<th width="10%">创建者</th>
|
||||
<th class="eud-pointer" width="11%">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
|
||||
<th width="9%">操作</th>
|
||||
<th width="14%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @shixuns.each do |shixun| %>
|
||||
|
|
@ -24,7 +24,12 @@
|
|||
<% if shixun.status == 0 %>
|
||||
<%= link_to(l(:button_delete), shixun_path(shixun), :method => :delete, :data => { confirm: "确认删除" } ) %>
|
||||
<% end %>
|
||||
<span class="fr shixun_webssh">
|
||||
<span class="fr ml5 shixun_hidden">
|
||||
<input type="checkbox" <%= shixun.hidden ? 'checked' : "" %> value="0" id="shixun_hidden_<%= shixun.id %>" name="hidden" class="ml-3 mr5 magic-checkbox">
|
||||
<label style="top:0px;padding-left: 19px;" for="shixun_hidden_<%= shixun.id %>">隐藏</label>
|
||||
<div class="undis"><%= shixun.id %></div>
|
||||
</span>
|
||||
<span class="fr ml5 shixun_webssh">
|
||||
<input type="checkbox" <%= shixun.webssh ? 'checked' : "" %> value="0" id="join_course_role_<%= shixun.id %>" class="ml-3 mr5 magic-checkbox">
|
||||
<label style="top:0px;padding-left: 19px;" for="join_course_role_<%= shixun.id %>">ssh</label>
|
||||
<div class="undis"><%= shixun.id %></div>
|
||||
|
|
@ -54,10 +59,7 @@
|
|||
});
|
||||
});
|
||||
$(".shixun_webssh").on("click", 'input', function(ev){
|
||||
//console.log($(ev.target));
|
||||
console.log($(ev.target).parent().find("div").html());
|
||||
var id = $(ev.target).parent().find("div").html();
|
||||
console.log($(ev.target).parent().find("input").is(':checked'));
|
||||
var status = $(ev.target).parent().find("input").is(':checked');
|
||||
$.ajax({
|
||||
url:"<%= update_webssh_managements_path %>",
|
||||
|
|
@ -65,4 +67,13 @@
|
|||
data:{shixun_id: id, status: status}
|
||||
});
|
||||
});
|
||||
|
||||
$(".shixun_hidden").on("click", 'input', function(ev){
|
||||
var id = $(ev.target).parent().find("div").html();
|
||||
$.ajax({
|
||||
url:"<%= update_shixun_hidden_managements_path %>",
|
||||
dataType: "script",
|
||||
data:{shixun_id: id}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link href="../../../public/stylesheets/css/taskstyle.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/edu-common.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/edu-public.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/edu-class.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/edu-admin.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/font-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/moduel.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/bootstrap/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../../../public/stylesheets/css/magic-check.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../../../public/javascripts/application.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../../public/javascripts/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="edu-class-container">
|
||||
<!--当前位置-->
|
||||
<p class="mb10"><i class="fa fa-map-marker mr5 color-grey"></i>
|
||||
<a href="/users/innov">创新使者</a> >
|
||||
<span class="color-dark-grey">镜像管理 </span>
|
||||
</p>
|
||||
<!--ul导航条-->
|
||||
<!--<ul class="edu-admin-nav clearfix "></ul>-->
|
||||
<!--主要部分/列表-->
|
||||
<div class="edu-con-top clearfix mb20 df">
|
||||
<label class="fl mt5 mb5 ml15">镜像主类别:</label>
|
||||
<div class="fl" style="flex:1">
|
||||
<div class="task-tag tag-grey mr10 fl mt5 mb5" id="add_mirror_sort" style="display: none;">
|
||||
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_mirror_sort').slideToggle();">×</button>
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" id="mirror_sort_input" placeholder="请输入技能标签">
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="fl color-light-green mt5 mb5" onclick="$('#add_mirror_sort').slideToggle();" id="add_knowledge">+添加</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ex_container" id="management_mirror_list">
|
||||
<table class="edu-pop-table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<th width="4%">序号</th>
|
||||
<th width="8%" style="text-align: left;">镜像ID</th>
|
||||
<th width="11%" style="text-align: left;">镜像名称</th>
|
||||
<th width="17%" style="text-align: left;">镜像主类别</th>
|
||||
<th width="17%" style="text-align: left;">镜像小类别</th>
|
||||
<th width="16%" style="text-align: left;">镜像描述</th>
|
||||
<th width="7%">状态</th>
|
||||
<th width="12%">修改时间</th>
|
||||
<th width="7%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="edu-txt-center">1</td>
|
||||
<td>drfhuko4</td>
|
||||
<td class="break_word">java1.8-jfinal5.0</td>
|
||||
<td class="pl5 pr5">
|
||||
<p class="break_word">java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;</p>
|
||||
|
||||
<input type="text" name="input_con" class="undis with100" value="java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;"/>
|
||||
|
||||
</td>
|
||||
<td class="break_word">
|
||||
<p class="break_word pl5 pr5">docert1.5;centos2.5;</p>
|
||||
<input type="text" name="input_con" class="undis with100" value="docert1.5;centos2.5;"/>
|
||||
</td>
|
||||
<td class="pl5 pr5">镜像是。。。。</td>
|
||||
<td class="edu-txt-center">未发布</td>
|
||||
<td class="edu-txt-center">2017-08-15 10:34</td>
|
||||
<td class="edu-txt-center">
|
||||
<a href="javascript:void(0)" class="color-blue">删除</a>
|
||||
<a href="javascript:void(0)" class="color-blue update_table_date">修改</a>
|
||||
<a href="javascript:void(0)" class="color-blue save_table_date undis">保存</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="edu-txt-center">2</td>
|
||||
<td>edftg3gr</td>
|
||||
<td class="break_word">python3.6-mysql1.5</td>
|
||||
<td class="pl5 pr5">
|
||||
<p class="break_word">java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;</p>
|
||||
|
||||
<input type="text" name="input_con" class="undis with100" value="java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;"/>
|
||||
|
||||
</td>
|
||||
<td class="break_word">
|
||||
<p class="break_word pl5 pr5">docert1.5;centos2.5;</p>
|
||||
<input type="text" name="input_con" class="undis with100" value="docert1.5;centos2.5;"/>
|
||||
|
||||
</td>
|
||||
<td class="pl5 pr5">镜像是。。。。</td>
|
||||
<td class="edu-txt-center">已发布</td>
|
||||
<td class="edu-txt-center">2017-08-15 10:34</td>
|
||||
<td class="edu-txt-center">
|
||||
<a href="javascript:void(0)" class="color-blue update_table_date">修改</a>
|
||||
<a href="javascript:void(0)" class="color-blue save_table_date undis">保存</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="width: 500px" class="bor-grey-e white_bg open_box">
|
||||
<div class="task-popup-title clearfix task-popup-bggrey">
|
||||
<h3 class="fl ">镜像修改</h3>
|
||||
<a href="javascript:void(0)" onclick="hideModal();"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
<div class="task-popup-content">
|
||||
<div class="clearfix mb15">
|
||||
<label class="panel-form-label fl"><span class="mr10">镜像ID:</span></label>
|
||||
<label class="fl mt8">sdfdsf</label>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<label class="panel-form-label fl"><span class="mr10">主类别:</span></label>
|
||||
<div class="pr fl with80 status_con">
|
||||
<input type="text" name="type_mirror" class="panel-box-sizing task-form-100 task-height-40" placeholder="输入关键字搜索并选择"/>
|
||||
<ul class="lesson_checkbox">
|
||||
<li>
|
||||
<input name="course_id[]" data-val="数据结构" value="1" id="join_course_role_0" class="ml-3 mr5 magic-checkbox" type="checkbox">
|
||||
<label for="join_course_role_0">数据结构</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<label class="panel-form-label fl"><span class="mr10">小类别:</span></label>
|
||||
<div class="pr fl with80 status_con">
|
||||
<input type="text" name="type_mirror" class="panel-box-sizing task-form-100 task-height-40" placeholder="请输入该镜像的小类别"/>
|
||||
<ul class="lesson_checkbox">
|
||||
<li>
|
||||
<input name="course_id[]" data-val="数据结构" value="1" id="join_course_role_0" class="ml-3 mr5 magic-checkbox" type="checkbox">
|
||||
<label for="join_course_role_0">数据结构</label>
|
||||
</li>
|
||||
<li>
|
||||
<input name="course_id[]" data-val="数据结构" value="1" id="join_course_role_0" class="ml-3 mr5 magic-checkbox" type="checkbox">
|
||||
<label for="join_course_role_0">数据结构</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<label class="panel-form-label fl"><span class="mr10">描述:</span></label>
|
||||
<textarea type="text" class="panel-box-sizing task-form-80 task-height-100" placeholder="请输入该镜像的描述"></textarea>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<label class="panel-form-label fl"><span class="mr10">状态:</span></label>
|
||||
<span class="fl mr20 mt3">
|
||||
<input type="radio" name="status" value="0" id="status_0" class="ml-3 mr5 magic-radio">
|
||||
<label for="status_0">未发布</label>
|
||||
</span>
|
||||
<span class="fl mr20 mt3">
|
||||
<input type="radio" name="status" value="1" id="status_1" class="ml-3 mr5 magic-radio">
|
||||
<label for="status_1">已发布</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" clearfix mb20 mr15">
|
||||
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fr">取消</a>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr mr10">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
function add_tag(){
|
||||
var num = $(".task-bd-grey").children('div').length;
|
||||
var val = $(".task-tag-input").val().trim();
|
||||
if (val != ""){
|
||||
testLength = $(".task-tag-input").val().trim().length;
|
||||
$("#add_mirror_sort").before("<div class='task-tag tag-grey mr10 mt5 mb5 fl' id='knowledge_" + num + "'>" +
|
||||
"<button data-dismiss='alert' class='close fr mt3 ml5' type='button' onclick='close_tag(this)'>×</button>" +
|
||||
"<input style='width:"+ testLength*12 +"px' class='knowledge_frame' name='knowledge[input][]' value='" + val +"'>" +
|
||||
" </div>");
|
||||
$(".task-tag-input").attr("value","");
|
||||
}
|
||||
$("#mirror_sort_input").val("");
|
||||
$("#add_mirror_sort").hide();
|
||||
}
|
||||
|
||||
function close_tag(thisObj){
|
||||
// 获取父节点的id
|
||||
var obj = thisObj.parentNode.id;
|
||||
$("#"+obj).remove();
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$(".open_box").click(function(event){
|
||||
$(".lesson_checkbox").hide();
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
$("input[name='type_mirror']").on("keydown",function(event){
|
||||
//绑定数据
|
||||
|
||||
//显示下拉多选
|
||||
$(".lesson_checkbox").hide();
|
||||
$(this).siblings(".lesson_checkbox").show();
|
||||
event.stopPropagation();
|
||||
})
|
||||
|
||||
$(".lesson_checkbox").on("click",function(event){
|
||||
event.stopPropagation();
|
||||
})
|
||||
$(".lesson_checkbox").on('click', 'input',function(event) {
|
||||
alert($(this).attr("data-val"));
|
||||
event.stopPropagation();
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
<span class="ml30"><%= user.try(:user_extensions).try(:student_id) %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<span class="ml30 color-yellow"><%= identity_authentication_status(User.current.id) %></span>
|
||||
<span class="ml30 color-yellow"><%= user_certification_status(user) %></span>
|
||||
<span class="ml30 color-yellow"><%= pro_certification_status(user) %></span>
|
||||
</li>
|
||||
<div class="undis">
|
||||
<li class="clearfix edu-form-border mb10">
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
<span class="ml30"><%= user.try(:user_extensions).try(:student_id) %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<span class="ml30 color-yellow"><%= identity_authentication_status(User.current.id) %></span>
|
||||
<span class="ml30 color-yellow"><%= user_certification_status(user) %></span>
|
||||
<span class="ml30 color-yellow"><%= pro_certification_status(user) %></span>
|
||||
</li>
|
||||
<% if authorization.status == 2 %>
|
||||
<li>原因:<span class="color-orange"><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li>
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@
|
|||
<th width="15%">地区</th>
|
||||
<th width="20%" class="edu-txt-left">详细地址</th>
|
||||
<th width="10%">申请者</th>
|
||||
<th width="10%">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
|
||||
<th width="10%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
|
||||
<th width="10%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @apply_status.each do |apply| %>
|
||||
<tr>
|
||||
<td> <%= apply.id %></td>
|
||||
<td><%= apply.id %></td>
|
||||
<td class="edu-txt-left"><%= link_to apply.name,school_index_path(apply.id)%></td>
|
||||
<td>
|
||||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:20px; display: none">
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%= apply.id %>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:20px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
|
|
@ -66,17 +66,16 @@
|
|||
<td>
|
||||
<% user = User.where("id=?", apply.user_id).first %>
|
||||
<% unless user.nil? %>
|
||||
<%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
|
||||
<%= link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= format_date(apply.created_at) %>
|
||||
<%= format_time(apply.created_at) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
|
||||
<a href="javascript:void(0);" onclick="approve('<%= apply.id %>')">批准</a>
|
||||
<%= link_to( l(:button_delete),{ :controller => 'managements', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%= link_to '更改',all_schools_managements_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
@ -91,13 +90,29 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// var find=$("#shixun_Look_name").val();
|
||||
// function myFunction(){
|
||||
// if($("#shixun_Look_name").val()==""){
|
||||
// $(".d-none").css("display","none");
|
||||
// }else{
|
||||
// $(".d-none").css("display","block");
|
||||
// }
|
||||
// }
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
$("input[name='sx_order']").val(sx_order);
|
||||
$.ajax({
|
||||
url:"<%= unit_managements_path %>",
|
||||
data: $("#unit").serialize(),
|
||||
dateType: "script"
|
||||
});
|
||||
});
|
||||
function approve(apply_id) {
|
||||
$.ajax({
|
||||
url: "/managements/approve_applied_schools",
|
||||
data: {id: apply_id},
|
||||
type: 'post'
|
||||
});
|
||||
};
|
||||
// function button_delete(apply_id){
|
||||
// $.ajax({
|
||||
// url: "/admin/delete_applied_schools",
|
||||
// data: {id: apply_id},
|
||||
// type: 'post'
|
||||
// });
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<%= form_tag edit_applied_department_managements_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||
<div>
|
||||
<div class="courseReferContainer">
|
||||
<% if !department.empty? && !@search.nil? %>
|
||||
<% department.each do |department| %>
|
||||
<ul class="courseSend" >
|
||||
<li class="" style="display:inline-block">
|
||||
<input name="department_id[]" id="search_school_<%= department.id %>" type="radio" value="<%= department.id %>" class="courseSendCheckbox magic-radio"/>
|
||||
<label for="search_school_<%= department.id %>"><%= truncate(department.name, :lendght => 25)%></label>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
var height=$(".courseReferContainer").height();
|
||||
if (height>200){
|
||||
$(".courseReferContainer").css({"height":"200px","overflow-y":"auto"});
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<%= form_tag edit_applied_schools_managements_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||
<div>
|
||||
<%#= hidden_field_tag(:send_id, edit_id) %>
|
||||
<div class="courseReferContainer" >
|
||||
<% if !schools.empty? && !@search.nil? %>
|
||||
<% schools.each do |school| %>
|
||||
<ul class="courseSend">
|
||||
<li class="" style="display:inline-block">
|
||||
<input name="school_id[]" id="search_school_<%= school.id %>" type="radio" value="<%= school.id %>" class="courseSendCheckbox magic-radio"/>
|
||||
<label for="search_school_<%= school.id %>"><%= truncate(school.name, :lendght => 25)%></label>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
var height=$(".courseReferContainer").height();
|
||||
if (height>200){
|
||||
$(".courseReferContainer").css({"height":"200px","overflow-y":"auto"});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th > </th>
|
||||
<th>ID</th>
|
||||
<th>真实姓名</th>
|
||||
<th>职业</th>
|
||||
<th><a href="javascript:void(0);">学号</a></th>
|
||||
|
|
@ -13,13 +14,16 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<% authorization = ApplyAction.where(:user_id => user).first %>
|
||||
<% @users.each_with_index do |user,index| %>
|
||||
<% authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last %>
|
||||
<tr>
|
||||
<td style="padding-left:15px;">
|
||||
<input id="authorization_<%= user.id %>" type="checkbox" class="magic-checkbox" name="member_ids[]" value="<%= user.id %>">
|
||||
<label for="authorization_<%= user.id %>"> </label>
|
||||
</td>
|
||||
<td>
|
||||
<%= user.login %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to user.try(:show_real_name), user_path(user), :class => "edu-txt-w100 task-hide2" %>
|
||||
</td>
|
||||
|
|
@ -29,7 +33,7 @@
|
|||
<td><%= user.professional_certification ? "已认证" : "未认证" %></td>
|
||||
<td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td>
|
||||
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
|
||||
<td><%= identity_authentication_status(user.id) %></td>
|
||||
<td><%= identity_authentication_status(authorization.try(:status)) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<% if params[:search].nil? %>
|
||||
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/all_department', :locals => {:department => @department, :edit_id => @edit_id}) %>";
|
||||
pop_box_new(htmlvalue, 400, 260);
|
||||
<% else %>
|
||||
$("#schools_list").html("<%= escape_javascript(render :partial => 'managements/update_department_form', :locals => {:department => @department, :edit_id => @edit_id}) %>");
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<% if params[:search].nil? %>
|
||||
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/all_schools', :locals => {:schools => @schools, :edit_id => @edit_id}) %>";
|
||||
pop_box_new(htmlvalue, 400, 260);
|
||||
<% else %>
|
||||
$("#schools_list").html("<%= escape_javascript(render :partial => 'managements/update_school_form', :locals => {:schools => @schools, :edit_id => @edit_id}) %>");
|
||||
<% end %>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<input class="fl task-form-20 task-height-30 ml35 " name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name">
|
||||
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 " onclick="$('#classroom').submit();">搜索</a>
|
||||
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 " id="clear_contents">清除</a>
|
||||
<a href="#" class="task-btn task-btn-green fr mr30" >新增实训适用课程</a>
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr30" onclick="alert_new_major_type('<%= %>')">新增实训适用课程</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="edu-con-bg01 mt15" id="classroom_list">
|
||||
|
|
@ -12,6 +12,35 @@
|
|||
<script>
|
||||
function clearSearchCondition(){
|
||||
$("#Look_name").val("");
|
||||
$.get('<%= classroom_managements_path() %>');
|
||||
$.get('<%= applicable_course_managements_path() %>');
|
||||
}
|
||||
|
||||
function alert_new_major_type(){
|
||||
var htmlvalue ='<%= form_tag(url_for(add_course_managements_path),:id=>"add_course",:method => "post") do %>'+
|
||||
'<div style="width:400px" class="task-popup"><div class="task-popup-title clearfix"><h3 class="fl color-grey">新增实训适用课程</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
|
||||
'<div class="mt10 ml10 mb10">' +
|
||||
'<span class="ml40">请输入课程名称:</span><input type="text" id="new_course_name" name="course" class="ml25" >' +
|
||||
'</div>' +
|
||||
'<span class="color-orange ml20 fl none" style="margin-left: 12%;" id="new_course_name_notice">'+
|
||||
'<i class="fa fa-exclamation-circle mr5" ></i>'+
|
||||
'请输入名称</span>'+
|
||||
'<div class="cl"></div>' +
|
||||
'<div class="task-popup-submit clearfix ml25">' +
|
||||
'<a href="javascript:void(0);" class="task-btn fl pop_close mr10">取消</a>' +
|
||||
'<a href="javascript:void(0);" onclick="submit_new_course();" class="task-btn task-btn-blue fr" >确定</a>' +
|
||||
'</div>' +
|
||||
'</div>'+
|
||||
'<% end %>';
|
||||
pop_box_new(htmlvalue, 400, 145);
|
||||
}
|
||||
|
||||
function submit_new_course(){
|
||||
var insert_data = $("#new_course_name").val()
|
||||
if($("#new_course_name").val().trim() == ""){
|
||||
$("#new_course_name_notice").show();
|
||||
} else{
|
||||
$("#new_course_name_notice").hide();
|
||||
$("#add_course").submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#classroom_list").html("<%= j(render :partial => "managements/applicable_course_list") %>");
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
|
||||
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 ">清除</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="edu-con-bg01 mt15" id="management_class_shixun_list">
|
||||
<div class="edu-con-bg01 mt15" id="class_shixun_list">
|
||||
<%= render :partial => "managements/class_publish_shixuns_list" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<script>
|
||||
//清除查询条件
|
||||
function clearSearchCondition(){
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
$("#management_class_shixun_list").html("<%= j(render :partial => "managements/class_publish_shixuns_list") %>");
|
||||
$("#class_shixun_list").html("<%= j(render :partial => "managements/class_publish_shixuns_list") %>");
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<input class="fl task-form-20 task-height-30" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="cla_sx_Look_name" >
|
||||
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_shixuns_search').submit();">搜索</a>
|
||||
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 ">清除</a>
|
||||
<input name="sx_order" type="hidden">
|
||||
</div>
|
||||
<div class="edu-con-bg01 mt15" id="managements_class_shixuns_list">
|
||||
<%= render :partial => "managements/class_shixuns_list" %>
|
||||
|
|
|
|||
|
|
@ -4,29 +4,27 @@
|
|||
<%= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %>
|
||||
<%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
|
||||
<%= select_tag :major_id,options_for_select(syllabus_major_option, nil), {:id=>"major_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
|
||||
<select class="fl task-form-30 task-height-30" style="margin:20px 30px 10px 25px;" name="school_id" id="part">
|
||||
<option value="0" selected="selected">选择创建单位</option>
|
||||
<%= @schools.each do |school|%>
|
||||
<option value="<%= school.id %>"><%= school.name%></option>
|
||||
<% end%>
|
||||
</select>
|
||||
<li class="clearfix mb10 ml35 mt15 fl" style="display: inline-block">
|
||||
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" />
|
||||
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
|
||||
</div>
|
||||
<!--</select>-->
|
||||
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
|
||||
<option value="u_name">创建者姓名搜索</option>
|
||||
<option value="cla_name">课程名称搜索</option>
|
||||
</select>
|
||||
<span class="fr shixun_webssh">
|
||||
<input type="checkbox"class="mr5 magic-checkbox" id="join_course_role_1">
|
||||
<label style="top:-30px;padding-left:23px;" for="join_course_role_1"><span class="only_view">只看模板</span></label>
|
||||
</span>
|
||||
<input class="fl task-form-20 task-height-30 mt20" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name">
|
||||
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt20" onclick="$('#classroom').submit();">搜索</a>
|
||||
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
|
||||
<input name="sx_order" type="hidden">
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="edu-con-bg01 mt15" id="classroom_list">
|
||||
<%= render :partial => "managements/classroom_list" %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function clearSearchCondition(){
|
||||
$("#part").val("");
|
||||
|
|
@ -38,4 +36,55 @@
|
|||
$("#first_level_discipline_id").val("");
|
||||
$.get('<%= classroom_managements_path() %>');
|
||||
}
|
||||
</script>
|
||||
$("input[name='school']").on('input', function (e) {
|
||||
throttle(department_search_fn, window, e);
|
||||
});
|
||||
|
||||
var d_lastSearchCondition = '';
|
||||
var d_page = 1; //唯一控制页码 变量
|
||||
var d_count = 0; //查询结果的总量
|
||||
var d_maxPage = 0;//最大页面值
|
||||
function department_search_fn(e) {
|
||||
if($(e.target).val().trim() == ''){
|
||||
$("#search_school_result_list").hide();
|
||||
$("input[name='school_id']").val("");
|
||||
return;
|
||||
}
|
||||
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
|
||||
return;
|
||||
}
|
||||
d_lastSearchCondition = $(e.target).val().trim();
|
||||
page = 1; //有新的搜索,页面重置为1
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
|
||||
type: 'post',
|
||||
success: function (data) {
|
||||
d_schoolsResult = data.schools;
|
||||
count = data.count;
|
||||
maxPage = Math.ceil(count / 100); //最大页码值
|
||||
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
|
||||
var i = 0;
|
||||
$("#search_school_result_list").html('');
|
||||
for (; i < d_schoolsResult.length; i++) {
|
||||
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
|
||||
$("#search_school_result_list").append(link);
|
||||
}
|
||||
$("#search_school_result_list").css('left', $(e.target).offset().left);
|
||||
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
|
||||
$("#search_school_result_list").css("position", "absolute");
|
||||
$("#search_school_result_list").show();
|
||||
} else {
|
||||
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
|
||||
$("#search_school_result_list").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//修改部门
|
||||
function changeSchoolValue(value, data) {
|
||||
console.log(value+","+data)
|
||||
$("input[name='school']").val(value);
|
||||
$("input[name='school_id']").val(data);
|
||||
$("#search_school_result_list").hide();
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@
|
|||
<option value="0">正在进行(<%= @timing %>)</option>
|
||||
<option value="1">已结束(<%= @end %>)</option>
|
||||
</select>
|
||||
<select class="fl task-height-30" style="margin:0px 30px 0px 25px;padding: 5px;width: 25%" name="school_id" id="part">
|
||||
<option value="0" selected="selected">选择创建者单位</option>
|
||||
<% @schools.each do |school|%>
|
||||
<option value="<%= school.id %>"><%= school.name%></option>
|
||||
<% end %>
|
||||
</select>
|
||||
<li class="fl task-height-30 mb10 ml35" style="display: inline-block">
|
||||
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" />
|
||||
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
|
||||
</div>
|
||||
|
||||
<select class="fl task-form-15 task-height-30" style="margin:0px 0px 10px 25px;width: 11%" name="keyword" id="condition_status">
|
||||
<option value="u_name">创建者姓名搜索</option>
|
||||
<option value="cla_name">班级名称搜索</option>
|
||||
|
|
@ -19,11 +21,12 @@
|
|||
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
|
||||
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 " id="clear_contents">清除</a>
|
||||
<span class="fr shixun_webssh">
|
||||
<input type="checkbox"class="mr5 magic-checkbox" id="join_course_role_1">
|
||||
<label style="top:2px;padding-left:23px;" for="join_course_role_1"><span class="only_view">只看首页显示</span></label>
|
||||
</span>
|
||||
<input type="checkbox" class="mr5 magic-checkbox" name="homepage_show" value="1" id="join_course_role_0">
|
||||
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看首页显示</span></label>
|
||||
</span>
|
||||
<input name="sx_order" type="hidden">
|
||||
</div>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<div class="edu-con-bg01 mt15" id="managements_classroom_classment">
|
||||
<%= render :partial => "managements/classroom_classment_list" %>
|
||||
</div>
|
||||
|
|
@ -33,6 +36,61 @@
|
|||
$("#part").val("");
|
||||
$("#condition_status").val("uname")
|
||||
$("#Look_name").val("");
|
||||
$.get('<%=classroom_classment_managements_path() %>')
|
||||
$.get('<%= classroom_classment_managements_path() %>')
|
||||
};
|
||||
|
||||
$("#join_course_role_0").on('click', function(){
|
||||
$('#class_publish_shixuns_search').submit();
|
||||
});
|
||||
|
||||
$("input[name='school']").on('input', function (e) {
|
||||
throttle(department_search_fn, window, e);
|
||||
});
|
||||
var d_lastSearchCondition = '';
|
||||
var d_page = 1; //唯一控制页码 变量
|
||||
var d_count = 0; //查询结果的总量
|
||||
var d_maxPage = 0;//最大页面值
|
||||
function department_search_fn(e) {
|
||||
if($(e.target).val().trim() == ''){
|
||||
$("#search_school_result_list").hide();
|
||||
$("input[name='school_id']").val("");
|
||||
return;
|
||||
}
|
||||
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
|
||||
return;
|
||||
}
|
||||
d_lastSearchCondition = $(e.target).val().trim();
|
||||
page = 1; //有新的搜索,页面重置为1
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
|
||||
type: 'post',
|
||||
success: function (data) {
|
||||
d_schoolsResult = data.schools;
|
||||
count = data.count;
|
||||
maxPage = Math.ceil(count / 100); //最大页码值
|
||||
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
|
||||
var i = 0;
|
||||
$("#search_school_result_list").html('');
|
||||
for (; i < d_schoolsResult.length; i++) {
|
||||
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
|
||||
$("#search_school_result_list").append(link);
|
||||
}
|
||||
$("#search_school_result_list").css('left', $(e.target).offset().left);
|
||||
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
|
||||
$("#search_school_result_list").css("position", "absolute");
|
||||
$("#search_school_result_list").show();
|
||||
} else {
|
||||
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
|
||||
$("#search_school_result_list").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//修改部门
|
||||
function changeSchoolValue(value, data) {
|
||||
console.log(value+","+data)
|
||||
$("input[name='school']").val(value);
|
||||
$("input[name='school_id']").val(data);
|
||||
$("#search_school_result_list").hide();
|
||||
}
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue