From 7913a6883b470cc1ee422f03f16a32506ddd6d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 16 May 2014 15:18:45 +0200 Subject: [PATCH] #131 Wiki link shows filename for all users --- config/routes.rb | 2 +- init.rb | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 2907fc7c..e9eeaf82 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -71,7 +71,7 @@ RedmineApp::Application.routes.draw do post '/dmsf/files/:id/revision/create', :controller => 'dmsf_files', :action => 'create_revision' 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' + get '/dmsf/files/:id/download/:download', :controller => 'dmsf_files', :action => 'show', :as => 'download_revision' get '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'show', :as => 'dmsf_file' delete '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'delete' diff --git a/init.rb b/init.rb index 03cd54ae..3998a490 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,7 @@ Redmine::Plugin.register :redmine_dmsf do name 'DMSF' author 'Vit Jonas / Daniel Munn / Karel Picman' description 'Document Management System Features' - version '1.4.8 stable' + version '1.4.9 devel' url 'http://www.redmine.org/plugins/dmsf' author_url 'https://github.com/danmunn/redmine_dmsf/graphs/contributors' @@ -90,10 +90,10 @@ Redmine::Plugin.register :redmine_dmsf do return nil if args.length < 1 # require file id entry_id = args[0].strip entry = DmsfFile.find(entry_id) - unless entry.nil? || entry.deleted + if entry && !entry.deleted && User.current && User.current.allowed_to?(:view_dmsf_files, entry.project) title = args[1] ? args[1] : entry.title - revision = args[2] ? args[2] : '' - return link_to "#{title}", :controller => 'dmsf_files', :action => 'show', :id => entry, :download => revision, :only_path => false + revision = args[2] ? args[2] : '' + return link_to h(title), download_revision_path(entry, revision, :only_path => false) end nil end @@ -110,9 +110,9 @@ Redmine::Plugin.register :redmine_dmsf do else entry_id = args[0].strip entry = DmsfFolder.find(entry_id) - unless entry.nil? - title = args[1] ? args[1] : entry.title - return link_to "#{title}", :controller => 'dmsf', :action => 'show', :id => entry.project, :folder_id => entry, :only_path => false + if entry && User.current && User.current.allowed_to?(:view_dmsf_folders, entry.project) + title = args[1] ? args[1] : entry.title + return link_to h(title), dmsf_folder_path(entry.project, :folder_id => entry, :only_path => false) end end nil @@ -128,9 +128,9 @@ Redmine::Plugin.register :redmine_dmsf do return nil if args.length < 1 # require file id entry_id = args[0].strip entry = DmsfFile.find(entry_id) - unless entry.nil? || entry.deleted - title = args[1] ? args[1] : entry.title - return link_to "#{title}", :controller => 'dmsf_files', :action => 'show', :id => entry, :only_path => false + if entry && !entry.deleted && User.current && User.current.allowed_to?(:view_dmsf_files, entry.project) + title = args[1] ? args[1] : entry.title + return link_to h(title), dmsf_file_path(entry, :only_path => false) end nil end