Merge branch 'devel-1.4.9' of https://github.com/danmunn/redmine_dmsf into devel-1.4.9
This commit is contained in:
commit
33c3f8df11
@ -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)
|
||||
|
||||
@ -25,12 +25,13 @@
|
||||
<td class="check"><%= check_box_tag(name, id, false,
|
||||
:title => l(:title_check_for_zip_download_or_email)) %></td>
|
||||
<td class="title">
|
||||
<% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'show', :id => file, :download => ''}) %>
|
||||
<% file_view_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'view', :id => file}) %>
|
||||
<%= link_to(h(title),
|
||||
file_download_url,
|
||||
file_view_url,
|
||||
:target => "_blank",
|
||||
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
|
||||
:title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version),
|
||||
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
|
||||
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") %>
|
||||
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
|
||||
</td>
|
||||
<td class="size"><%= number_to_human_size(file.last_revision.size) %></td>
|
||||
|
||||
@ -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'
|
||||
|
||||
2
init.rb
2
init.rb
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user