添加文件预览接口
This commit is contained in:
parent
e786873061
commit
b6d22cfb31
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -110,6 +110,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'courselist'
|
||||
match 'zip'
|
||||
match 'mailer'
|
||||
match 'view_office'
|
||||
end
|
||||
##new added by linchun #以发布应用的形式参与竞赛
|
||||
resources :softapplications do
|
||||
|
|
Loading…
Reference in New Issue