diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index f4b8c6c91..abab48f3b 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -48,6 +48,8 @@ class MyshixunsController < ApplicationController jenkins_shixuns = Redmine::Configuration['jenkins_shixuns'] uri = URI("#{jenkins_shixuns}/jenkins-exec/webssh/deleteSSH") user_id = User.current.id + logger.info("#############################") + logger.info("game_id:" + @_params[:id]) params = {gameID:@_params[:id]} # @_params[:id] 是webssh传过来的gameId res = uri_exec uri, params if res && res['code'].to_i != 0 diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index d75511204..e73ce0214 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -88,7 +88,6 @@ class SubjectsController < ApplicationController end def publish - @subject.update_attributes(:status => 1) apply = ApplyAction.where(:container_type => "ApplySubject", :container_id => @subject.id).order("created_at desc").first if apply && apply.status == 0 @status = 0 @@ -96,6 +95,7 @@ class SubjectsController < ApplicationController if Shixun.where(:id => @subject.stage_shixuns.map(&:shixun_id), :status => [0, 1]).count > 0 @status = 2 else + @subject.update_attributes(:status => 1) ApplyAction.create(:container_type => "ApplySubject", :container_id => @subject.id, :user_id => User.current.id, :status => 0) notes = User.current.show_name.to_s + " 申请发布课程实训:#{@subject.name}" JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8680c6cb9..29fbf65f0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -164,7 +164,7 @@ module ApplicationHelper # 实训语言的种类 def shixun_language - ["Java", "C", "C++", "Python", "MySQL/Java"] + ["Java", "C", "C++", "Python", "MySQL/Java","JFinal","Docker","Ethoernet","Dynamips"] end # 实训试用专业 diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index 5e57b85e9..cf0579655 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -60,7 +60,8 @@ class Myshixun < ActiveRecord::Base games = self.games current_game = games.select{|game| game.status == 1 || game.status == 0}.first if current_game.blank? - passed_games = games.select{|game| game.status == 2} + game_id = '(' + games.map(&:id).join(',') + ')' + passed_games = games.find_by_sql("SELECT *, (SELECT c.position from `challenges` c where g.challenge_id = c.id) as pos FROM `games` g where g.status = 2 and g.id in #{game_id} ORDER BY pos desc") current_game = passed_games.first end return current_game diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 3b199c484..7a36fa413 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -5,10 +5,10 @@ <%= @challenges.count %> <% end %> <% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %> - - - - 新建阶段 + +单选任务 + +多选任务 + +编程任务 + <% end %>
<% @challenges.each_with_index do |challenge, index| -%> diff --git a/app/views/challenges/_edit_task_pass.html.erb b/app/views/challenges/_edit_task_pass.html.erb index 0e602d69d..4781c0bb5 100644 --- a/app/views/challenges/_edit_task_pass.html.erb +++ b/app/views/challenges/_edit_task_pass.html.erb @@ -31,11 +31,41 @@ <% end %> <% end %> + +
<%# if @challenge.st == 1 %> - - <%# end %>
  • @@ -25,11 +31,14 @@
  • - - - - - + +
  • 保存 <% if params[:action] == "new" %> @@ -68,7 +77,62 @@ imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>"//url }); + + var bt = baidu.template; + bt.LEFT_DELIMITER = ''; + + $("#shixun_form").on('click', 'a.option_icon_add', function () { + var html = bt('t:set-option-list', null); + $(this).parent().parent('.clearfix').before(html); + var inputs = document.getElementsByName("option_inputs_label"); + var inputs_spans = document.getElementsByName("option_span"); + for (var j = 0; j < inputs_spans.length; j++) { + if(j >= 0 && j <= 26){ + $(inputs_spans[j]).html(String.fromCharCode(65 + j)); + } + } + for (var i = 0; i < inputs.length; i++) { + autoTextarea(inputs[i], 0, 140); + } + $(inputs[inputs.length - 1]).focus(); + }); + $("#shixun_form").on('click', 'a.option_icon_remove', function () { + $(this).parent('.clearfix').remove(); + var inputs_spans = document.getElementsByName("option_span"); + for (var j = 0; j < inputs_spans.length; j++) { + if(j >= 0 && j <= 26){ + if(j >= 0 && j <= 26){ + $(inputs_spans[j]).html(String.fromCharCode(65 + j)); + } + } + } + }); }); + //设置选项答案 + function selectchoice(item){ + //判断是否选中,如果选中,再次点击的时候取消选中 + if($(item).hasClass('check-option-bg')){ + $(item).removeClass('check-option-bg'); + }else{ + if(true){ + //单选 + $(".select-choice").removeClass('check-option-bg'); + $(item).addClass('check-option-bg'); + }else{ + //多选 + $(item).addClass('check-option-bg'); + } + } + $("#current-option").html(""); + if($(".check-option-bg").length>0){ + for(var i=0;i<$(".check-option-bg").length;i++){ + $("#current-option").html($("#current-option").html()+$(".check-option-bg").eq(i).html()); + } + }else{ + $("#current-option").html("请点击正确选项"); + } + } window.onload = function(){ $("#challenge_task_pass [type=\"latex\"]").bind("click", function(){ taskpass_editormd.cm.replaceSelection("```latex"); diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index e4285c23d..35755bb00 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -133,20 +133,25 @@ $(function(){ } ); doc.bind('mousemove',function(e){ + + $(".-brother").show();// 代码行的遮罩显示 if(dragging) { clickX = e.pageX; - if(clickX > leftOffset + 300&&clickX leftOffset+300&&clickX topOffset) { + if(clickY > topOffset+100) { cen.css('top', clickY - 7 - topOffset + 'px'); cen.prev().height( clickY-topOffset + 'px'); nextW1 = clickY-topOffset; @@ -156,10 +161,12 @@ $(function(){ } } }); + doc.mouseup(function(e) { flag = false; dragging = false; e.cancelBubble = true; + $(".-brother").hide(); // 代码行的遮罩隐藏 }); }) /*-----------------------------------------------------------------------------------*/ diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb index 8e60e8224..7ad823935 100644 --- a/app/views/games/_repository.html.erb +++ b/app/views/games/_repository.html.erb @@ -8,7 +8,7 @@
  • <% end %>
    - <% if @path == @game.challenge.path.strip %> + <% if @path == @game.challenge.path.try(:strip) %> <% end %> @@ -46,7 +46,7 @@
    -
    +
    @@ -61,6 +61,7 @@
    +
    \ No newline at end of file diff --git a/app/views/subjects/_subject_top.html.erb b/app/views/subjects/_subject_top.html.erb index ce124f27a..add31b9ef 100644 --- a/app/views/subjects/_subject_top.html.erb +++ b/app/views/subjects/_subject_top.html.erb @@ -13,9 +13,9 @@ <% end %> <% if !User.current.manager_of_subject?(@subject) || @subject.status > 1 %> <% elsif @subject.status == 0 && @subject.stages.count > 0 && User.current.manager_of_subject?(@subject) %> <%= link_to '申请发布', publish_subject_path(@subject), :class => "course-btn fr", :remote => true %> @@ -31,6 +31,7 @@ $(".edit_subject_name").on("click",function(){ $(".subject-main-name").attr("contenteditable","true"); $(".subject-main-name").focus(); + getC($(".subject-main-name")); }); $(".subject-main-name").on("keydown",function(ev){ if(ev.keyCode==13 || ev.keyCode==108){ @@ -46,4 +47,15 @@ } ); }) + + function getC(that){ + if(document.all){ + that.range=document.selection.createRange(); + that.range.select(); + that.range.moveStart("character",-1); + }else{ + that.range=window.getSelection().getRangeAt(0); + that.range.setStart(that.range.startContainer,that.html().length); + } + } \ No newline at end of file diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 98298e1b4..1ab903787 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -18,6 +18,7 @@ $(".subject-produce").html(""); }; $("#subject-produce").focus(); + getC($("#subject-produce")); }); $(".subject-produce").on("keydown",function(ev){ if(ev.keyCode==13 || ev.keyCode==108){ @@ -38,6 +39,16 @@ $("#subject-produce").removeClass("color-light-grey"); } }) + function getC(that){ + if(document.all){ + that.range=document.selection.createRange(); + that.range.select(); + that.range.moveStart("character",-1); + }else{ + that.range=window.getSelection().getRangeAt(0); + that.range.setStart(that.range.startContainer,that.html().length); + } + }
    diff --git a/public/stylesheets/css/edu-subject.css b/public/stylesheets/css/edu-subject.css index 9ea88df50..c1fe54c60 100644 --- a/public/stylesheets/css/edu-subject.css +++ b/public/stylesheets/css/edu-subject.css @@ -70,8 +70,7 @@ li.li-width10{width: 10%;text-align: left} .allback{background-color:#FFFFFF} -.last-all-count{width: 20%;text-align: right;} -.last-all-count li{float: left;width: 33.3%;} +.last-all-count{text-align: right;} .course-option{width: 570px;padding: 10px;background-color: #FFFFFF;} .magic-radio + label:before, .magic-checkbox + label:before{top: 11px;left: 5px;} diff --git a/public/stylesheets/css/edu-user.css b/public/stylesheets/css/edu-user.css index dba560039..9e5fea434 100644 --- a/public/stylesheets/css/edu-user.css +++ b/public/stylesheets/css/edu-user.css @@ -102,7 +102,7 @@ .-task-con-int .passageway .hascon .expand{display:block;;height:70px;line-height:70px;text-align:center;color:#5faee3;} .-task-con-int .passageway .hascon .expand:hover{ color:#5faee3;} .bg_shadow{-webkit-box-shadow: 0 0 10px #ccc;-moz-box-shadow: 0 0 10px #ccc;box-shadow: 0 0 10px #ccc;} -.new_expand{display:block;;height:70px;line-height:70px;text-align:center;color:#5faee3; background: #fafbfb} +.new_expand{display:block;;height:70px;line-height:70px;text-align:center;color:#5faee3; background: #FFFFFF} .new_expand:hover{ color:#5faee3;} /*--------------------------------------箭头动画效果-----------------------------------*/ .-task-con-int .passageway .hint .zhuan{ diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 82ea7b9da..5d5f6539a 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -12,7 +12,7 @@ html,body{ font-size:14px; line-height:2.0; height:100%;} a.user-info-img{ display: block; width: 50px; height: 50px; margin:0 auto; } a.user-info-img img{border-radius:100px;border:2px solid #666;} a.user-info-img img:hover{border:2px solid #888;} -a.user-info-name{ display: block; font-size: 16px; color: #fff; max-width:100px; margin: 10px auto; text-align: center;} +a.user-info-name{ display: block; font-size: 16px; color: #fff; max-width:100px; margin: 10px auto; text-align: center; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .leftnav-box{ width: 80px; height: 60px; background:#292b3a; padding:10px 0; margin-bottom:2px;} a.leftnav-box-inner{ display: block; width:77px; border-left:3px solid #292b3a; background:#292b3a; text-align: center; padding:10px 0; color:#575f6c;} a:hover.leftnav-box-inner,a.leftnav-active{border-left:3px solid #3498db;color: #fff!important;} @@ -98,6 +98,7 @@ input.panel-form-width-100{ padding:5px;width:100%; height:40px; min-width:700px textarea.panel-form-width-100{ padding:5px;width:100%; height:150px; min-width:700px;} textarea.panel-form-width-40{ padding:5px;width:100%; height: 40px; min-width:700px;} textarea.panel-form-width-690{ padding:5px;width:90%; height:150px; min-width:700px;} +textarea.panel-form-width2-690{ padding:5px;width:90%; height:40px; min-width:700px;} .panel-form-width-670{ width: 670px; padding:5px;} .panel-form-height-150{ height: 150px;} .panel-form-height-30{height: 30px;} @@ -145,12 +146,14 @@ input.knowledge_frame{height:30px;line-height:30px;border:none;background:#f3f5f .-scroll{ overflow:auto;} .-flex-basic0{flex-basis: 0%!important; display: none} /*王昌------------拖拽增加样式---------------修改*/ -.-flex-basic40{flex-basis: auto;} -.-flex-basic50{flex-basis: auto;} -.b-label{width:2px;cursor:e-resize;} -.h-center{height:2px;cursor:n-resize;background:#2b2b2b;z-index:9999;} +.-flex-basic40{flex-basis:auto;} +.-flex-basic50{flex-basis:auto;} +.b-label{width:4px;cursor:ew-resize;background:#2b2b2b;} +.h-center{height:4px;cursor:ns-resize;background:#33485F;z-index:9999;} +.-brother{width:100%;height:100%;position:absolute;left:0;top:0;z-index:999;} +.-bg-weightblack{background:#000;} /*---------------------------------------------*/ -.-flex-basic60{flex-basis: 70%;} +.-flex-basic60{flex:4 9 auto;} .-flex-basic100{flex-basis: 100%!important;} .-header-title{ max-width:500px; font-weight: normal;} .-header-right{ background:#333;border-radius:25px; padding:5px 15px; height: 30px; position: absolute; right:10px;line-height: 30px;} @@ -329,3 +332,12 @@ a.shixun-task-ban-btn{background-color: #c2c4c6;display: inline-block;font-weigh .comment-input{width: 90%;padding: 0px 10px;} .comment-input textarea{border: none !important;width:86%; outline: none;height: 30px;border-radius: 4px;margin-right: 10px;padding-left: 5px;float:left} .comment_position{ position: absolute;bottom: 8px;} + +/*-------新建阶段添加选项部分----------*/ +.option-item{border:1px solid #e2e2e2;} +.add-option-item{border:1px dashed #e2e2e2;} +.option-item,.add-option-item{display: block;width: 38px;height: 38px;text-align: center;line-height: 38px;border-radius: 4px} +.check-option-bg{background: #ee4a1f;color: #ffffff!important;border: 1px solid #ee4a1f} +.add-option-input{padding: 5px;width: 90%;height: 40px;min-width: 700px;border: 1px dashed #e2e2e2;} +.add-option-input a{display: block;width: 100%;height: 100%;cursor: pointer} +.position-delete{position: absolute;right: -17px;top: 12px;cursor: pointer}