PHP/Web实训功能
This commit is contained in:
parent
bdb80aba12
commit
d4dfa38bd9
|
|
@ -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.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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<span class="mt10 -flex c_grey ml15" id="time-consuming"></span>
|
||||
<!--<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span>-->
|
||||
<% if @myshixun.shixun.try(:language) == "PHP/Web" %>
|
||||
<a href="<%= web_display_myshixun_game_path(@game, :myshixun_id => @myshixun) %>" target="_blank" class="shixun-task-btn task-btn-orange mr15 mt8">查看网页效果</a>
|
||||
<% end %>
|
||||
<% if @st == 0 %>
|
||||
<div id="reset_code_to_bengin" class="<%= @game.status == 2 ? "" : "undis" %>">
|
||||
<a href="javascript:void(0)" class="shixun-task-btn task-btn-green mr15 mt8" onclick="delete_confirm_box('<%= reset_new_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本关中修改的内容将丢失<br />是否确定重新加载上次通过的代码');">加载上次通过的代码</a>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
<iframe src='<%= @url %>' style='width:100%;border:0;' scrolling='no' class='game_webssh'>
|
||||
</iframe>
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in New Issue