Merge pull request #279 from RamDav/devel-1.4.9

added view url for dmsf files
This commit is contained in:
Karel Picman 2014-08-08 06:31:31 +02:00
commit c9b4c4e1a2
3 changed files with 15 additions and 1 deletions

View File

@ -29,6 +29,19 @@ class DmsfFilesController < ApplicationController
helper :all
helper :dmsf_workflows
def view
@revision = @file.last_revision
check_project(@revision.file)
access = DmsfFileRevisionAccess.new(:user_id => User.current.id, :dmsf_file_revision_id => @revision.id,
:action => DmsfFileRevisionAccess::DownloadAction)
access.save!
send_file(@revision.disk_file,
:filename => filename_for_content_disposition(@revision.name),
:type => @revision.detect_content_type,
:disposition => 'inline')
end
def show
# The download is put here to provide more clear and usable links
if params.has_key?(:download)

View File

@ -73,6 +73,7 @@ RedmineApp::Application.routes.draw do
get '/dmsf/files/:id/revision/delete', :controller => 'dmsf_files', :action => 'delete_revision', :as => 'delete_revision'
get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show', :download => '' # Otherwise will not route nil download param
get '/dmsf/files/:id/download/:download', :controller => 'dmsf_files', :action => 'show', :as => 'download_revision'
get '/dmsf/files/:id/view', :controller => 'dmsf_files', :action => 'view'
get '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'show', :as => 'dmsf_file'
delete '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'delete'
get '/dmsf/files/:id/restore', :controller => 'dmsf_files', :action => 'restore', :as => 'restore_dmsf_file'

View File

@ -59,7 +59,7 @@ Redmine::Plugin.register :redmine_dmsf do
{:dmsf_state => [:user_pref_save]}
permission :view_dmsf_files,
{:dmsf => [:entries_operation, :entries_email, :download_email_entries, :tag_changed],
:dmsf_files => [:show],
:dmsf_files => [:show, :view],
:dmsf_files_copy => [:new, :create, :move],
:dmsf_workflows => [:log]},
:read => true