diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d5522b898..bc60fc027 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -3,7 +3,7 @@ class GamesController < ApplicationController layout "base_myshixun" skip_before_filter :verify_authenticity_token, :only => [:file_update] before_filter :find_myshixun, :only => [:index] - before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time, + before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time, :web_display, :game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice, :sync_codes] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show] before_filter :allowd_manager @@ -496,6 +496,20 @@ class GamesController < ApplicationController end end + # web渲染 + def web_display + path = @game.challenge.path.strip + port = (50000 + @game.myshixun_id).to_s + # 测试 + #path = "src/step1/Helloworld.php" + #port = (50000+4116).to_s + @url = "http://106.75.96.108:" + port + '/' + path + + respond_to do |format| + format.html{render :layout => false} + end + end + def minus_score @game_challenge = @game.challenge user = User.current diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index a2aadf706..fad907f1c 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -118,6 +118,7 @@ class MyshixunsController < ApplicationController # resubmit 1:表示已通关后重新评测;0:表示非重新评测 # retry_status 0:初始值;1:重新评测失败;2:重新评测成功 def training_task_status + #params[:jsonTestDetails] = '{"buildID":"1","compileSuccess":"1","msg":[{"caseId":"1","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","input":"Mg0KMjMsNTYsNzgsOTANCjIxLDU2LDc4LDc2LDkx","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","passed":"1"},{"caseId":"2","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","input":"Mw0KOTgsNzYsNTQNCjkwLDU0LDg3LDQNCjc4LDI2LDEyLDkw","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","passed":"1"}],"outPut":"Y29tcGlsZSBzdWNjZXNzZnVsbHk","resubmit":"57D9COBR_5806","status":"0"}' jsonTestDetails = JSON.parse(params[:jsonTestDetails]) status = jsonTestDetails['status'] game_id = jsonTestDetails['buildID'] @@ -131,7 +132,9 @@ class MyshixunsController < ApplicationController challenge = game.challenge unless jenkins_testsets.blank? jenkins_testsets.each do |j_test_set| + logger.info("j_test_set: ############## #{j_test_set['output']}") actual_output = tran_base64_decode64(j_test_set['output']) + logger.info "actual_output:################################################# #{actual_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, :compile_success => compile_success.to_i) # output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 311530b80..b5b272889 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4845,7 +4845,7 @@ def get_hw_index(hw,is_teacher,type=0) end end hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? - index = hw_ids.index(hw.id) + index = hw_ids.length - 1 - hw_ids.index(hw.id) return index end diff --git a/app/models/memo.rb b/app/models/memo.rb index 1eb8f29aa..dc12fe367 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } validates_length_of :subject, maximum: 50 - validates_length_of :content, maximum: 30000 + validate :cannot_reply_to_locked_topic, :on => :create diff --git a/app/views/courses/settings/_all_student_list.html.erb b/app/views/courses/settings/_all_student_list.html.erb index ad54ce938..c0be48c37 100644 --- a/app/views/courses/settings/_all_student_list.html.erb +++ b/app/views/courses/settings/_all_student_list.html.erb @@ -9,14 +9,14 @@ <% if @no_group_count > 0 %>
  • -

    未分班<%= @no_group_count %>

    +

    未分班<%= @no_group_count %>

  • <% end %> <% unless @course.course_groups.empty? %> <% @course.course_groups.each do |group| %>
  • - <%= group.name %> + <%= group.name %> <%= group.members.count %>

    @@ -31,7 +31,7 @@ \ No newline at end of file diff --git a/app/views/shixuns/index.html.erb b/app/views/shixuns/index.html.erb index cee2e50e1..21ba7e96f 100644 --- a/app/views/shixuns/index.html.erb +++ b/app/views/shixuns/index.html.erb @@ -94,6 +94,14 @@
  • +
  • + + +
  • +
  • + + +
  • diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index e06a1754c..454714b72 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -28,7 +28,7 @@ <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> - <%= link_to @homework.homework_detail_manual.comment_status == 3 ? '评阅' : '查看', student_work_path(student_work), :class => 'link-color-blue', :target => "_blank" %> + <%= link_to @homework.homework_detail_manual.comment_status == 3 ? '评阅' : '查看', student_work_path(student_work), :class => '', :target => "_blank" %> <% end%> diff --git a/app/views/student_work/_homework_reply_detail.html.erb b/app/views/student_work/_homework_reply_detail.html.erb index 7fe4d4401..acb33b8ec 100644 --- a/app/views/student_work/_homework_reply_detail.html.erb +++ b/app/views/student_work/_homework_reply_detail.html.erb @@ -10,16 +10,16 @@ });
    -
    -
    +
    +
    <%= comment.content_detail.html_safe %>
    <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> -
    +
    -
    +
    <%= link_to('回复'.html_safe, {:controller => 'users', :action => 'reply_to_comment', diff --git a/app/views/student_work/_student_work_score.html.erb b/app/views/student_work/_student_work_score.html.erb index 265952a84..aa704bf9d 100644 --- a/app/views/student_work/_student_work_score.html.erb +++ b/app/views/student_work/_student_work_score.html.erb @@ -54,10 +54,10 @@
    - <%= link_to image_tag(url_to_avatar(show_real_name_for_appeal ? score.student_works_scores_appeal.user : ""), :width => "32", :height => "32"), show_real_name_for_appeal ? user_path(score.student_works_scores_appeal.user) : "javascript:void(0)", :target => "_blank" %> + <%= link_to image_tag(url_to_avatar(show_real_name_for_appeal ? score.student_works_scores_appeal.user : ""), :width => "32", :height => "32"), show_real_name_for_appeal ? user_path(score.student_works_scores_appeal.user) : "javascript:void(0)", :style => "cursor: text",:target => "_blank" %>
    - <%= link_to show_real_name_for_appeal ? score.student_works_scores_appeal.user.show_real_name : "匿名", show_real_name_for_appeal ? user_path(score.student_works_scores_appeal.user.show_real_name) : "javascript:void(0)", :title => show_real_name ? score.student_works_scores_appeal.user.show_real_name : "匿评用户", :class => "content-username" %> + <%= link_to show_real_name_for_appeal ? score.student_works_scores_appeal.user.show_real_name : "匿名", show_real_name_for_appeal ? user_path(score.student_works_scores_appeal.user.show_real_name) : "javascript:void(0)", :style => "cursor: text", :class => "content-username color-grey-no-a" %> <%=format_time score.student_works_scores_appeal.updated_at %>
    <%= score.student_works_scores_appeal.comment%>
    diff --git a/app/views/users/_course_attachment.html.erb b/app/views/users/_course_attachment.html.erb index 3fcd856bb..33ac05126 100644 --- a/app/views/users/_course_attachment.html.erb +++ b/app/views/users/_course_attachment.html.erb @@ -6,7 +6,7 @@
    - <%= link_to activity.filename, course_files_path(activity.course), :class => "color-dark" %> + <%= link_to activity.filename, course_files_path(activity.course), :class => "color-grey3" %>
    <% if activity.try(:author).show_real_name == ' ' %> diff --git a/config/routes.rb b/config/routes.rb index f772ec526..f879b4ac6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -157,6 +157,7 @@ RedmineApp::Application.routes.draw do match 'prev_step', :via => [:get, :post] match 'reset_original_code', :via => [:get, :post] match 'reset_new_code', :via => [:get, :post] + match 'web_display', :via => [:get, :post] get 'entry' get 'outputs_show' get 'game_status' diff --git a/db/migrate/20171012101648_migrate_exercise_question_num.rb b/db/migrate/20171012101648_migrate_exercise_question_num.rb new file mode 100644 index 000000000..7db6136f0 --- /dev/null +++ b/db/migrate/20171012101648_migrate_exercise_question_num.rb @@ -0,0 +1,17 @@ +class MigrateExerciseQuestionNum < ActiveRecord::Migration + def up + count = Exercise.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + Exercise.page(i).per(30).each do |exercise| + exercise.exercise_questions.reorder("created_at asc").each_with_index do |question, j| + question.update_column('question_number', j + 1) + end + end + end + end + end + + def down + end +end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b9820a850..b36bfec99 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2517,6 +2517,7 @@ function init_exercise_quetison_editor(params){ var edit = this.edit; var body = edit.doc.body; edit.iframe.height(48); + //this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight+30 : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight+30)), 48)); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+30, 48)); }, afterBlur:function(){ diff --git a/public/stylesheets/css/edu-class.css b/public/stylesheets/css/edu-class.css index a1fe30246..ec1fa7488 100644 --- a/public/stylesheets/css/edu-class.css +++ b/public/stylesheets/css/edu-class.css @@ -189,7 +189,7 @@ em{font-style:normal;} .stud-class-set .news .container .member .people .left li:hover{background:#EFF9FD;border-left:3px solid #ff7500;color:#ff7500;} .stud-class-set .news .container .member .people .left li:hover .p1 em{color: #FFFFFF;background: #FF7500!important;} .stud-class-set .news .container .member .people .left li .p1{position:relative;} -.stud-class-set .news .container .member .people .left li .p1 span{max-width:115px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display:inline-block;float:left} +.stud-class-set .news .container .member .people .left li .p1 span{max-width:96px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display:inline-block;float:left} .edu-break-out{max-width:115px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display:inline-block;float:left} .edu-break-outshort{max-width:96px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display:inline-block;float:left} .stud-class-set .news .container .member .people .left li .p1 em{margin-left:10px;font-size:12px;background:#e9e9e9;border-radius:8px;padding:2px 5px;} diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css index 8c9774893..14f28e245 100644 --- a/public/stylesheets/css/edu-public.css +++ b/public/stylesheets/css/edu-public.css @@ -113,7 +113,7 @@ a.panel-name-small{ display: inline-block; max-width:100px; color:#29bd8b; font- .comment_item_cont .J_Comment_Face img{ width:50px; height:50px; border-radius:100px; } .panel-comment_item .t_content{ width:93%; margin-left:15px;} .panel-comment_item a.content-username {font-size:14px; margin-right:15px; display:inline-block; max-width:100px;color: #888888} -.panel-comment_item a:hover.content-username{color:#FF7500;} +/*.panel-comment_item a:hover.content-username{color:#FF7500;}*/ .panel-comment_item .orig_user img{width:40px; height:40px;border-radius:100px; } .panel-comment_item .reply-right{ float:right; position:relative;} .panel-comment_item .reply_iconup02{ position:absolute; top:22px; left:14px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;} @@ -253,6 +253,7 @@ a.task-index-name{ display: inline-block; max-width:80px;} /*作业描述、帖子内容*/ .upload_img img{max-width: 100%;} +.table_maxWidth table {max-width: 642px;} .list_style ol li{list-style-type: decimal;margin-left: 40px;} .list_style ul li{list-style-type: disc;margin-left: 40px;} @@ -399,5 +400,4 @@ input::-ms-input-placeholder,textarea::-ms-input-placeholder {color:#cccccc;} /*评阅状态*/ .checkstatus_box_small{width: 10px;height: 10px;display: block;float: left;margin-right: 3px;} .checkstatus_box_big{cursor: default;width: 30px;height: 30px;line-height: 30px;text-align: center;margin-right: 10px;border:1px solid #CCCCCC;display: block;float: left;} -.checkstatus_box_big i{position: absolute;top:18px;left: 10px;} - +.checkstatus_box_big i{position: absolute;top:18px;left: 10px;} \ No newline at end of file diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 51d6515dc..b393ea380 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -247,7 +247,7 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f .task-index-list-title{ max-width:80%; display: block; margin:10px auto 0px; font-size:14px; font-weight: bold;} .task-index-list-user{padding:5px 10px; border-radius:25px;background: #F5F6F7; margin:0px auto 20px; display: inline-block;} .task-index-list-box-bottom{ background: #F5F6F7; color:#666; padding:10px 10%; text-align: center;} -.task-index-list-box-bottom li{ display: inline; margin: 0 15px;} +.task-index-list-box-bottom li{ display: inline; margin: 0 5px;} .task-vip{ position: absolute; right:15px; top:15px;} @-webkit-keyframes bounce-down { 25% {-webkit-transform: translateY(-10px);}