dev_shixuns
daiao 6 years ago
commit 95a8be8cf6

@ -17,7 +17,7 @@ require 'digest'
class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token
# before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :save_para
before_filter :user_setup

@ -70,22 +70,7 @@
</div>
<% end %>
<script>
/* -------------- 简介Md -------------------- */
var shixunPro = editormd.markdownToHTML("shixuns_propaedeutics", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
/* -------------- 简介Md -------------------- */
var shixunPro = editormd.markdownToHTML("subject_learning_notes", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
var flag = true;
$(function() {

@ -109,6 +109,23 @@
<% end %>
</div>
<script>
/* -------------- 简介Md -------------------- */
var shixunPro = editormd.markdownToHTML("shixuns_propaedeutics", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
/* -------------- 课程须知MD -------------------- */
var shixunPro = editormd.markdownToHTML("subject_learning_notes", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
//点击新建阶段
$(".click_add").click(function(){
if($("#new_stage_form").length == 1){

@ -1,4 +1,17 @@
class CreateShixunStudentWorks < ActiveRecord::Migration
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 up
ActiveRecord::Base.transaction do
begin
@ -20,6 +33,7 @@ class CreateShixunStudentWorks < ActiveRecord::Migration
end
gshixun = g.fork(shixun.gpid, user.gid)
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
code = down_generate_identifier("myshixun")
# 一般通过默认分支是否存在来判断一个项目是否fork成功
if gshixun.try(:id).present?
@ -33,11 +47,15 @@ class CreateShixunStudentWorks < ActiveRecord::Migration
:onclick_time => Time.now, :gpid => gshixun.id,
:git_url => gshixun.try(:path_with_namespace), :commit_id => commit_id)
rep_url = Base64.urlsafe_encode64(gitlab_url shixun) # 注意educoder为默认给实训创建版本库的用户如果换成别的用户名字要相应的修改
url = "#{Redmine::Configuration['gitlab_address_ip']}/#{g.project(shixun.try(:gpid)).try(:path_with_namespace)}.git"
rep_url = Base64.urlsafe_encode64(url) # 注意educoder为默认给实训创建版本库的用户如果换成别的用户名字要相应的修改
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: gshixun.try(:name)}
logger.info("openGameInstance params is #{params}")
res = uri_exec uri, params
uri = URI.parse(URI.encode(uri.strip))
res = Net::HTTP.post_form(uri, params).body
res = JSON.parse(res)
if (res && res['code'].to_i != 0)
raise("实训云平台繁忙繁忙等级83")
end
@ -64,7 +82,7 @@ class CreateShixunStudentWorks < ActiveRecord::Migration
end
rescue Exception => e
puts ("###failed to exec shixun: current task id is #{e}")
g.delete_project(gshixun.id) if gshixun.try(:id).present?
# g.delete_project(gshixun.id) if gshixun.try(:id).present?
raise ActiveRecord::Rollback
end
end

@ -1521,22 +1521,24 @@ function my_account_form_submit() {
}
}
if ($("input[name='new_password']").length>0){
if($("input[name='new_password']").val().length<8){
$("#new_password").focus();
$("#new_password_hint").show();
return;
} else {
$("#new_password_hint").hide();
}
if($("input[name='new_password']").val().length<8){
$("#new_password").focus();
$("#new_password_hint").show();
return;
} else {
$("#new_password_hint").hide();
if($("input[name='new_password']").val() !== $("input[name='new_password_confirmation']").val() ){
$("#new_password_confirmation").focus();
$("#new_password_confirmation_hint").show();
return;
} else {
$("#new_password_confirmation_hint").hide();
}
}
if($("input[name='new_password']").val() !== $("input[name='new_password_confirmation']").val() ){
$("#new_password_confirmation").focus();
$("#new_password_confirmation_hint").show();
return;
} else {
$("#new_password_confirmation_hint").hide();
}
if ($("#userIdentity").val() == -1) {
$("#identity_hint").show();

Loading…
Cancel
Save