diff --git a/.gitignore b/.gitignore index 5810401cb..fdb7a3c6b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.swp /config/database.yml /config/configuration.yml +/config/additional_environment.rb /files/* /log/* diff --git a/Gemfile b/Gemfile index c1f7bcbeb..660a7ff49 100644 --- a/Gemfile +++ b/Gemfile @@ -6,10 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end -source 'http://rubygems.oneapm.com' do - gem 'oneapm_rpm' -end - +gem 'rest-client' gem "mysql2", "= 0.3.18" gem 'redis-rails' gem 'rubyzip' diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d880ebe35..b2364165b 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -69,9 +69,12 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), - :disposition => 'attachment' #inline can open in browser + req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx', :txtDes => File.new(@attachment.diskfile, 'rb') + render :text => req.body + + # send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), + # :type => detect_content_type(@attachment), + # :disposition => 'attachment' #inline can open in browser end else diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index 51ff293f1..12fead4f2 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -1,3 +1,5 @@ +require 'net/http' + class TestController < ApplicationController helper :UserScore @@ -5,6 +7,10 @@ class TestController < ApplicationController def bootstrap; end + def view_office + + end + def zip homeworks_attach_path = [] homework_id = params[:homework_id] diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 476471897..256a976c4 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -195,7 +195,6 @@ <%= link_to "更多>>", forums_path %> <% topics = find_new_forum_topics(10) %> - <%# cache topics.maximum(:created_at) do%>