diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad55cb8b..56b92501 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,34 @@
Changelog for Redmine DMSF
==========================
+1.4.8: **
+-----------------------
+
+ Symbolic links
+ Document tagging
+ Localization of email notifications
+ An option to send document links by email
+
+ * New: Issue #19 - Documentation?
+ * Update: Issue #106 - [Feature Request] Save files in folder structure defined via DMSF
+ * Fix: Issue #107 - Problems upgrading redmine 1.3 to 2.23 regarding DMFS
+ * Fix: Issue #111 - Cannot sort files in folders by date, size, etc
+ * Update: Issue #139 - Error 500 on click on "details" icon
+ * New: Issue #183 - Create document links
+ * New: Issue #201 - Download link by email
+ * Fix: Issue #205 - Ampersand shows up in displayed filenames as "&" instead of "&"
+ * Fix: Issue #212 - Incorrect revision information in email notification
+ * Fix: Issue #214 - Required DMSF custom field prevents documents to be saved
+ * Update: Issue #216 - Enhancement : having notification emails translated
+ * Update: Issue #224 - Setup/Upgrade documentation
+ * Fix: Issue #226 - undefined method `custom_fields_tabs' for module `CustomFieldsHelper'
+ * Fix: Issue #233 - Failed Travis builds
+ * Update: Issue #235 - "You are not member of the project" when changing project notification.
+ * New: Issue #236 - Documents tagging
+ * Fix: Issue #240 - Internal server error, redmine 2.5.1-devel.13064, PostgreSQL, dmsf 1.4.8-devel
+ * Fix: Issue #242 - dsmf 1.4.8 minor ... "link form" tab
+ * Fix: Issue #246 - "File storage directory" does not default properly when setting is empty
+
1.4.7: *2014-01-02*
-----------------------
diff --git a/Gemfile b/Gemfile
index 781bcbf1..838ae835 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,6 +4,7 @@ gem 'rubyzip', '>= 1.0.0'
gem 'zip-zip' # Just to avoid 'cannot load such file -- zip/zip' error
gem 'simple_enum'
gem 'uuidtools', '~> 2.1.1'
+gem 'dav4rack', '=0.2.11'
group :production do
gem 'nokogiri', '>= 1.5.10'
diff --git a/README.md b/README.md
index 58c62b41..a0e0e8e4 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,13 @@
Redmine DMSF Plugin
===================
-The current version of Redmine DMSF is **1.4.7**
+The current version of Redmine DMSF is **1.4.8** [](https://travis-ci.org/danmunn/redmine_dmsf)
Redmine DMSF is Document Management System Features plugin for Redmine issue tracking system; It is aimed to replace current Redmine's Documents module.
Redmine DMSF now comes bundled with Webdav functionality: if switched on within plugin settings this will be accessible from /dmsf/webdav.
-Webdav functionality is provided through DAV4Rack, however is provided bundled due to modifications made, DAV4Rack is released under the terms of the
-MIT license, more information can be found at
+Webdav functionality is provided through DAV4Rack gem.
Initial development was for Kontron AG R&D department and it is released as open source thanks to their generosity.
Project home:
@@ -28,26 +27,21 @@ Features
* Document locking
* Multi (drag/drop depending on browser) upload/download
* Multi download via zip
- * Direct document sending via email
+ * Direct document or document link sending via email
* Configurable document approval workflow
* Document access auditing
* Integration with Redmine's activity feed
* Wiki macros for quick content linking
* Full read/write webdav functionality
* Optional document content fulltext search
- * Compatible with redmine 2.0.x
+ * Documents and folders symbolic links
+ * Document tagging
+ * Compatible with redmine 2.5.x
Dependencies
------------
-
-As of version 1.4.4 of this plugin:
-
- * Bundler 1.1 or greater (Gem)
- * Redmine 2.0.x
- * Rails 3.2.x (Inline with Redmine installation requirement)
- * rubyzip 1.0.0 (Gem)
- * UUIDTools 2.1.1 or greater (less than 2.2.0) (Gem)
- * simple_enum (Gem)
+
+ * Redmine 2.3.x or higher
### Fulltext search (optional)
@@ -117,7 +111,9 @@ The DMSF file/revision id can be found in link for file/revision download from w
The DMSF folder id can be found in the link when opening folders within Redmine.
-You can also publish Wiki help description: In the file /public/help/wiki_syntax_detailed.html, after the document link description/definition:
+You can also publish Wiki help description:
+
+In the file /public/help//wiki_syntax_detailed.html, after the document link description/definition:
@@ -134,6 +130,11 @@ You can also publish Wiki help description: In the file /public/he
+In the file /public/help//wiki_syntax.html, at the end of the Redmine links section:
+
+ {{dmsf(83)}} Document #83
+
+
Setup / Upgrade
---------------
@@ -142,16 +143,21 @@ Before installing ensure that the Redmine instance is stopped.
1. In case of upgrade BACKUP YOUR DATABASE first
2. Put redmine_dmsf plugin directory into plugins
3. Initialize/Update database: `rake redmine:plugins:migrate RAILS_ENV="production"`
-4. The access rights must be set for web server, example: `chown -R www-data:www-data /opt/redmine/plugins/redmine_dmsf`
-*Ensure that the path used in the above is adjusted for your installation*
+4. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf`
5. Restart web server
6. You should configure plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure
7. Assign DMSF permissions to appropriate roles
8. There are two rake tasks:
a) To convert documents from the standard Redmine document module
- rake redmine:dmsf_convert_documents project=test RAILS_ENV="production"
+ Available options:
+ * project => id or identifier of project (defaults to all projects)
+ * dry => true or false (default false) to perform just check without any conversion
+ * invalid=replace => to perform document title invalid characters replacement for '-'
+ Example:
+ rake redmine:dmsf_convert_documents project=test RAILS_ENV="production"
b) To alert all users who are expected to do an approval in the current approval steps
- rake redmine:dmsf_alert_approvals RAILS_ENV="production"
+ Example:
+ rake redmine:dmsf_alert_approvals RAILS_ENV="production"
### Fulltext search (optional)
If you want to use fulltext search features, you must setup file content indexing.
@@ -188,4 +194,4 @@ Changes with tests, and full documentation are preferred.
Additional Documentation
------------------------
-[CHANGELOG.md](CHANGELOG.md) - Project changelog
+[CHANGELOG.md](CHANGELOG.md) - Project changelog
\ No newline at end of file
diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb
index 29b272fa..a3f361fd 100644
--- a/app/controllers/dmsf_controller.rb
+++ b/app/controllers/dmsf_controller.rb
@@ -1,8 +1,8 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
-# Copyright (C) 2013 Karel Pičman
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -26,7 +26,7 @@ class DmsfController < ApplicationController
class FileNotFound < StandardError; end
before_filter :find_project
- before_filter :authorize, :except => [:delete_entries]
+ before_filter :authorize
before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
before_filter :find_parent, :only => [:new, :create]
@@ -37,36 +37,116 @@ class DmsfController < ApplicationController
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)
@force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project)
+ @workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0
+
unless @folder
- @subfolders = @project.dmsf_folders.visible
- @files = @project.dmsf_files.visible
+ if params[:custom_field_id].present? && params[:custom_value].present?
+ @subfolders = []
+ DmsfFolder.where(:project_id => @project.id).visible.each do |f|
+ f.custom_field_values.each do |v|
+ if v.custom_field_id == params[:custom_field_id].to_i
+ if v.custom_field.compare_values?(v.value, params[:custom_value])
+ @subfolders << f
+ break
+ end
+ end
+ end
+ end
+ @files = []
+ DmsfFile.where(:project_id => @project.id).visible.each do |f|
+ r = f.last_revision
+ if r
+ r.custom_field_values.each do |v|
+ if v.custom_field_id == params[:custom_field_id].to_i
+ if v.custom_field.compare_values?(v.value, params[:custom_value])
+ @files << f
+ break
+ end
+ end
+ end
+ end
+ end
+ @dir_links = []
+ DmsfLink.where(:project_id => @project.id, :target_type => DmsfFolder.model_name).visible.each do |l|
+ l.target_folder.custom_field_values.each do |v|
+ if v.custom_field_id == params[:custom_field_id].to_i
+ if v.custom_field.compare_values?(v.value, params[:custom_value])
+ @dir_links << l
+ break
+ end
+ end
+ end
+ end
+ @file_links = []
+ DmsfLink.where(:project_id => @project.id, :target_type => DmsfFile.model_name).visible.each do |l|
+ r = l.target_file.last_revision
+ if r
+ r.custom_field_values.each do |v|
+ if v.custom_field_id == params[:custom_field_id].to_i
+ if v.custom_field.compare_values?(v.value, params[:custom_value])
+ @file_links << l
+ break
+ end
+ end
+ end
+ end
+ end
+ else
+ @subfolders = @project.dmsf_folders.visible
+ @files = @project.dmsf_files.visible
+ @dir_links = @project.folder_links.visible
+ @file_links = @project.file_links.visible
+ end
+ @locked_for_user = false
else
@subfolders = @folder.subfolders.visible
- @files = @folder.files.visible
+ @files = @folder.files.visible
+ @dir_links = @folder.folder_links.visible
+ @file_links = @folder.file_links.visible
@locked_for_user = @folder.locked_for_user?
end
- @files.sort! do |a,b|
- if a.last_revision && b.last_revision
- a.last_revision.title <=> b.last_revision.title
- else
- 0
- end
- end
-
@ajax_upload_size = Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'].present? ? Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'] : 100
end
+
+ def download_email_entries
+ send_file(
+ params[:path],
+ :filename => 'Documents.zip',
+ :type => 'application/zip',
+ :disposition => 'attachment')
+ rescue Exception => e
+ flash[:error] = e.message
+ end
- def entries_operation
- selected_folders = params[:subfolders]
- selected_files = params[:files]
+ def entries_operation
+ # Download/Email
+ selected_folders = params[:subfolders].present? ? params[:subfolders] : []
+ selected_files = params[:files].present? ? params[:files] : []
+ selected_dir_links = params[:dir_links]
+ selected_file_links = params[:file_links]
- if selected_folders.nil? && selected_files.nil?
- flash[:warning] = l(:warning_no_entries_selected)
- redirect_to :action => 'show', :id => @project, :folder_id => @folder
+ if selected_folders.blank? && selected_files.blank? &&
+ selected_dir_links.blank? && selected_file_links.blank?
+ flash[:warning] = l(:warning_no_entries_selected)
+ redirect_to :back
return
end
+ if selected_dir_links.present?
+ selected_dir_links.each do |id|
+ link = DmsfLink.find_by_id id
+ selected_folders << link.target_id if link
+ end
+ end
+
+ if selected_file_links.present?
+ selected_file_links.each do |id|
+ link = DmsfLink.find_by_id id
+ selected_files << link.target_id if link
+ end
+ end
+
if params[:email_entries].present?
email_entries(selected_folders, selected_files)
else
@@ -74,74 +154,117 @@ class DmsfController < ApplicationController
end
rescue ZipMaxFilesError
flash[:error] = l(:error_max_files_exceeded, :number => Setting.plugin_redmine_dmsf['dmsf_max_file_download'])
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
+ redirect_to :back
rescue EmailMaxFileSize
flash[:error] = l(:error_max_email_filesize_exceeded, :number => Setting.plugin_redmine_dmsf['dmsf_max_email_filesize'])
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
+ redirect_to :back
rescue FileNotFound
render_404
rescue DmsfAccessError
render_403
end
+
+ def tag_changed
+ # Tag filter
+ if params[:dmsf_folder] && params[:dmsf_folder][:custom_field_values].present?
+ redirect_to dmsf_folder_path(
+ :id => @project,
+ :custom_field_id => params[:dmsf_folder][:custom_field_values].first[0],
+ :custom_value => params[:dmsf_folder][:custom_field_values].first[1])
+ else
+ redirect_to :back
+ end
+ end
def entries_email
@email_params = params[:email]
- if @email_params['to'].strip.blank?
+ if @email_params[:to].strip.blank?
flash.now[:error] = l(:error_email_to_must_be_entered)
render :action => 'email_entries'
return
- end
- DmsfMailer.send_documents(User.current, @email_params['to'], @email_params['cc'],
- @email_params['subject'], @email_params['zipped_content'], @email_params['body']).deliver
+ end
+ DmsfMailer.send_documents(@project, User.current, @email_params).deliver
File.delete(@email_params['zipped_content'])
flash[:notice] = l(:notice_email_sent, @email_params['to'])
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
+
+ redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder)
end
def delete_entries
selected_folders = params[:subfolders]
selected_files = params[:files]
- if selected_folders.nil? && selected_files.nil?
+ selected_dir_links = params[:dir_links]
+ selected_file_links = params[:file_links]
+ if selected_folders.blank? && selected_files.blank? &&
+ selected_dir_links.blank? && selected_file_links.blank?
flash[:warning] = l(:warning_no_entries_selected)
else
- failed_entries = []
- deleted_files = []
- deleted_folders = []
- if selected_folders
- if User.current.allowed_to?(:folder_manipulation, @project)
+ failed_entries = []
+
+ if User.current.allowed_to?(:folder_manipulation, @project)
+ # Folders
+ if selected_folders.present?
selected_folders.each do |subfolderid|
- subfolder = DmsfFolder.visible.find(subfolderid)
- next if subfolder.nil?
+ subfolder = DmsfFolder.visible.find_by_id subfolderid
+ next unless subfolder
if subfolder.project != @project || !subfolder.delete
- failed_entries.push(subfolder)
- else
- deleted_folders.push(subfolder)
+ failed_entries.push(subfolder)
end
- end
- else
- flash[:error] = l(:error_user_has_not_right_delete_folder)
+ end
end
+ # Folder links
+ if selected_dir_links.present?
+ selected_dir_links.each do |dir_link_id|
+ link_folder = DmsfLink.visible.find_by_id dir_link_id
+ next unless link_folder
+ if link_folder.project != @project || !link_folder.delete
+ failed_entries.push(link_folder)
+ end
+ end
+ end
+ else
+ flash[:error] = l(:error_user_has_not_right_delete_folder)
end
- if selected_files
- if User.current.allowed_to?(:file_manipulation, @project)
+
+ deleted_files = []
+ if User.current.allowed_to?(:file_manipulation, @project)
+ # Files
+ if selected_files.present?
selected_files.each do |fileid|
- file = DmsfFile.visible.find(fileid)
+ file = DmsfFile.visible.find_by_id fileid
next unless file
if file.project != @project || !file.delete
failed_entries.push(file)
else
deleted_files.push(file)
end
- end
- else
- flash[:error] = l(:error_user_has_not_right_delete_file)
+ end
end
+ # File links
+ if selected_file_links.present?
+ selected_file_links.each do |file_link_id|
+ file_link = DmsfLink.visible.find_by_id file_link_id
+ next unless file_link
+ if file_link.project != @project || !file_link.delete
+ failed_entries.push(file_link)
+ end
+ end
+ end
+ else
+ flash[:error] = l(:error_user_has_not_right_delete_file)
end
+
unless deleted_files.empty?
deleted_files.each do |f|
log_activity(f, 'deleted')
end
- DmsfMailer.files_deleted(User.current, deleted_files).deliver
+ begin
+ DmsfMailer.get_notify_users(User.current, deleted_files).each do |u|
+ DmsfMailer.files_deleted(u, @project, deleted_files).deliver
+ end
+ rescue Exception => e
+ Rails.logger.error "Could not send email notifications: #{e.message}"
+ end
end
if failed_entries.empty?
flash[:notice] = l(:notice_entries_deleted)
@@ -149,8 +272,8 @@ class DmsfController < ApplicationController
flash[:warning] = l(:warning_some_entries_were_not_deleted, :entries => failed_entries.map{|e| e.title}.join(', '))
end
end
-
- redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
+
+ redirect_to :back
end
# Folder manipulation
@@ -194,16 +317,16 @@ class DmsfController < ApplicationController
end
end
- def delete
- check_project(@delete_folder = DmsfFolder.visible.find(params[:delete_folder_id]))
+ def delete
+ @delete_folder = DmsfFolder.visible.find(params[:delete_folder_id])
if @delete_folder
if @delete_folder.delete
flash[:notice] = l(:notice_folder_deleted)
else
flash[:error] = @delete_folder.errors[:base][0]
end
- end
- redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
+ end
+ redirect_to dmsf_folder_path(:id => @project, :folder_id => @delete_folder.dmsf_folder_id)
rescue DmsfAccessError
render_403
end
@@ -229,14 +352,8 @@ class DmsfController < ApplicationController
@project.save
end
flash[:notice] = l(:notice_folder_notifications_activated)
- end
- if params[:current]
- redirect_to params[:current]
- elsif @folder
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder})
- else
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project})
end
+ redirect_to :back
end
def notify_deactivate
@@ -250,17 +367,10 @@ class DmsfController < ApplicationController
@project.save
end
flash[:notice] = l(:notice_folder_notifications_deactivated)
- end
- if params[:current]
- redirect_to params[:current]
- elsif @folder
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder})
- else
- redirect_to({:controller => 'dmsf', :action => 'show', :id => @project})
end
+ redirect_to :back
end
-
def lock
if @folder.nil?
flash[:warning] = l(:warning_foler_unlockable)
@@ -269,9 +379,8 @@ class DmsfController < ApplicationController
else
@folder.lock!
flash[:notice] = l(:notice_folder_locked)
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}
+ end
+ redirect_to :back
end
def unlock
@@ -286,9 +395,8 @@ class DmsfController < ApplicationController
else
flash[:error] = l(:error_only_user_that_locked_folder_can_unlock_it)
end
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}
+ end
+ redirect_to :back
end
private
@@ -302,9 +410,9 @@ class DmsfController < ApplicationController
zip = DmsfZip.new
zip_entries(zip, selected_folders, selected_files)
- ziped_content = "#{DmsfHelper.temp_dir}/#{DmsfHelper.temp_filename('dmsf_email_sent_documents.zip')}";
+ zipped_content = "#{DmsfHelper.temp_dir}/#{DmsfHelper.temp_filename('dmsf_email_sent_documents.zip')}";
- File.open(ziped_content, 'wb') do |f|
+ File.open(zipped_content, 'wb') do |f|
zip_file = File.open(zip.finish, 'rb')
while (buffer = zip_file.read(8192))
f.write(buffer)
@@ -312,7 +420,7 @@ class DmsfController < ApplicationController
end
max_filesize = Setting.plugin_redmine_dmsf['dmsf_max_email_filesize'].to_f
- if max_filesize > 0 && File.size(ziped_content) > max_filesize * 1048576
+ if max_filesize > 0 && File.size(zipped_content) > max_filesize * 1048576
raise EmailMaxFileSize
end
@@ -323,7 +431,11 @@ class DmsfController < ApplicationController
audit.save!
end
- @email_params = {'zipped_content' => ziped_content}
+ @email_params = {
+ :zipped_content => zipped_content,
+ :folders => selected_folders,
+ :files => selected_files
+ }
render :action => 'email_entries'
rescue Exception => e
flash[:error] = e.message
@@ -357,14 +469,14 @@ class DmsfController < ApplicationController
def zip_entries(zip, selected_folders, selected_files)
if selected_folders && selected_folders.is_a?(Array)
- selected_folders.each do |selected_folder_id|
- check_project(folder = DmsfFolder.visible.find(selected_folder_id))
+ selected_folders.each do |selected_folder_id|
+ folder = DmsfFolder.visible.find(selected_folder_id)
zip.add_folder(folder, (@folder.dmsf_path_str if @folder)) if folder
end
end
if selected_files && selected_files.is_a?(Array)
- selected_files.each do |selected_file_id|
- check_project(file = DmsfFile.visible.find(selected_file_id))
+ selected_files.each do |selected_file_id|
+ file = DmsfFile.visible.find(selected_file_id)
if file && file.last_revision && File.exists?(file.last_revision.disk_file)
zip.add_file(file, (@folder.dmsf_path_str if @folder)) if file
else
@@ -379,34 +491,22 @@ class DmsfController < ApplicationController
zip
end
- def find_project
- @project = Project.find(params[:id])
- end
-
def find_folder
- @folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?('folder_id')
- check_project(@folder)
+ @folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?('folder_id')
rescue DmsfAccessError
render_403
end
def find_parent
- @parent = DmsfFolder.visible.find(params[:parent_id]) if params.keys.include?('parent_id')
- check_project(@parent)
+ @parent = DmsfFolder.visible.find(params[:parent_id]) if params.keys.include?('parent_id')
rescue DmsfAccessError
render_403
end
- def check_project(entry)
- if entry && entry.project != @project
- raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
- end
- end
-
def copy_folder(folder)
copy = folder.clone
copy.id = folder.id
copy
end
-end
+end
\ No newline at end of file
diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb
index c612b455..16dabde0 100644
--- a/app/controllers/dmsf_files_controller.rb
+++ b/app/controllers/dmsf_files_controller.rb
@@ -59,97 +59,104 @@ class DmsfFilesController < ApplicationController
end
@revision = @file.last_revision
- # TODO: line bellow is to handle old installations with errors in data handling
- @revision.name = @file.name
@revision_pages = Paginator.new @file.revisions.visible.count, params['per_page'] ? params['per_page'].to_i : 25, params['page']
render :layout => !request.xhr?
end
-
- #TODO: don't create revision if nothing change
+
def create_revision
- unless params[:dmsf_file_revision]
- redirect_to :action => 'show', :id => @file
- return
- end
- if @file.locked_for_user?
- flash[:error] = l(:error_file_is_locked)
- redirect_to :action => 'show', :id => @file
- else
- #TODO: validate folder_id
- @revision = DmsfFileRevision.new(params[:dmsf_file_revision])
-
- @revision.file = @file
- @revision.project = @file.project
- last_revision = @file.last_revision
- @revision.source_revision = last_revision
- @revision.user = User.current
-
- @revision.major_version = last_revision.major_version
- @revision.minor_version = last_revision.minor_version
- version = params[:version].to_i
- file_upload = params[:file_upload]
- if file_upload.nil?
- @revision.disk_filename = last_revision.disk_filename
- @revision.increase_version(version, false)
- @revision.mime_type = last_revision.mime_type
- @revision.size = last_revision.size
- else
- @revision.increase_version(version, true)
- @revision.size = file_upload.size
- @revision.disk_filename = @revision.new_storage_filename
- @revision.mime_type = Redmine::MimeType.of(file_upload.original_filename)
- end
-
- @file.name = @revision.name
- @file.folder = @revision.folder
-
- if @revision.valid? && @file.valid?
- @revision.save!
- @revision.assign_workflow(params[:dmsf_workflow_id])
- if file_upload
- @revision.copy_file_content(file_upload)
- end
-
- if @file.locked? && !@file.locks.empty?
- begin
- @file.unlock!
- flash[:notice] = "#{l(:notice_file_unlocked)}, "
- rescue Exception => e
- logger.error "Cannot unlock the file: #{e.message}"
+ if params[:dmsf_file_revision]
+ if @file.locked_for_user?
+ flash[:error] = l(:error_file_is_locked)
+ else
+ @revision = DmsfFileRevision.new(params[:dmsf_file_revision])
+
+ @revision.file = @file
+ @revision.project = @file.project
+ last_revision = @file.last_revision
+ @revision.source_revision = last_revision
+ @revision.user = User.current
+
+ @revision.major_version = last_revision.major_version
+ @revision.minor_version = last_revision.minor_version
+ version = params[:version].to_i
+ file_upload = params[:file_upload]
+ unless file_upload
+ @revision.disk_filename = last_revision.disk_filename
+ @revision.increase_version(version, false)
+ @revision.mime_type = last_revision.mime_type
+ @revision.size = last_revision.size
+ else
+ @revision.increase_version(version, true)
+ @revision.size = file_upload.size
+ @revision.disk_filename = @revision.new_storage_filename
+ @revision.mime_type = Redmine::MimeType.of(file_upload.original_filename)
+ end
+
+ @file.name = @revision.name
+ @file.folder = @revision.folder
+
+ if @revision.valid? && @file.valid?
+ @revision.save!
+ @revision.assign_workflow(params[:dmsf_workflow_id])
+ if file_upload
+ @revision.copy_file_content(file_upload)
end
+
+ if @file.locked? && !@file.locks.empty?
+ begin
+ @file.unlock!
+ flash[:notice] = "#{l(:notice_file_unlocked)}, "
+ rescue Exception => e
+ logger.error "Cannot unlock the file: #{e.message}"
+ end
+ end
+ @file.save!
+ @file.set_last_revision @revision
+
+ flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created)
+ log_activity('new revision')
+ begin
+ recipients = DmsfMailer.get_notify_users(User.current, [@file])
+ recipients.each do |u|
+ DmsfMailer.files_updated(u, @project, [@file]).deliver
+ end
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
+ end
+ rescue Exception => e
+ logger.error "Could not send email notifications: #{e.message}"
+ end
end
- @file.save!
- @file.reload
-
- flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created)
- log_activity('new revision')
- begin
- DmsfMailer.files_updated(User.current, [@file]).deliver
- rescue Exception => e
- logger.error "Could not send email notifications: #{e.message}"
- end
- redirect_to :action => 'show', :id => @file
- else
- render :action => 'show'
end
end
+ redirect_to :back
end
def delete
if @file
if @file.delete
flash[:notice] = l(:notice_file_deleted)
- log_activity('deleted')
- DmsfMailer.files_deleted(User.current, [@file]).deliver
+ log_activity('deleted')
+ begin
+ DmsfMailer.get_notify_users(User.current, [@file]).each do |u|
+ DmsfMailer.files_deleted(u, @project, [@file]).deliver
+ end
+ rescue Exception => e
+ Rails.logger.error "Could not send email notifications: #{e.message}"
+ end
else
@file.errors.each do |e, msg|
flash[:error] = msg
end
end
end
- redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder
+ redirect_to dmsf_folder_path(:id => @project, :folder_id => @file.folder)
end
def delete_revision
@@ -172,9 +179,8 @@ class DmsfFilesController < ApplicationController
else
@file.lock!
flash[:notice] = l(:notice_file_locked)
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
+ end
+ redirect_to :back
end
def unlock
@@ -187,9 +193,8 @@ class DmsfFilesController < ApplicationController
else
flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it)
end
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
+ end
+ redirect_to :back
end
def notify_activate
@@ -198,9 +203,8 @@ class DmsfFilesController < ApplicationController
else
@file.notify_activate
flash[:notice] = l(:notice_file_notifications_activated)
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
+ end
+ redirect_to :back
end
def notify_deactivate
@@ -209,9 +213,8 @@ class DmsfFilesController < ApplicationController
else
@file.notify_deactivate
flash[:notice] = l(:notice_file_notifications_deactivated)
- end
- redirect_to params[:current] ? params[:current] :
- {:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
+ end
+ redirect_to :back
end
private
@@ -234,13 +237,16 @@ class DmsfFilesController < ApplicationController
def find_file
@file = DmsfFile.visible.find(params[:id])
@project = @file.project
- rescue
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
def find_revision
@revision = DmsfFileRevision.visible.find(params[:id])
@file = @revision.file
@project = @file.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
def check_project(entry)
diff --git a/app/controllers/dmsf_files_copy_controller.rb b/app/controllers/dmsf_files_copy_controller.rb
index e080c5a8..5213e3ff 100644
--- a/app/controllers/dmsf_files_copy_controller.rb
+++ b/app/controllers/dmsf_files_copy_controller.rb
@@ -68,14 +68,9 @@ class DmsfFilesCopyController < ApplicationController
end
flash[:notice] = l(:notice_file_copied)
- log_activity(new_file, 'was copied (is copy)')
- begin
- DmsfMailer.files_updated(User.current, [new_file]).deliver
- rescue ActionView::MissingTemplate => e
- Rails.logger.error "Could not send email notifications: #{e.message}"
- end
+ log_activity(new_file, 'was copied (is copy)')
- redirect_to :controller => 'dmsf_files', :action => 'show', :id => new_file
+ redirect_to dmsf_file_path(new_file)
end
def move
@@ -105,15 +100,9 @@ class DmsfFilesCopyController < ApplicationController
@file.reload
flash[:notice] = l(:notice_file_moved)
- log_activity(@file, 'was moved (is copy)')
- begin
- # TODO: implement proper mail notification
- DmsfMailer.files_updated(User.current, [@file]).deliver
- rescue ActionView::MissingTemplate => e
- Rails.logger.error "Could not send email notifications: #{e.message}"
- end
+ log_activity(@file, 'was moved (is copy)')
- redirect_to :controller => 'dmsf_files', :action => 'show', :id => @file
+ redirect_to dmsf_file_path(@file)
end
private
diff --git a/app/controllers/dmsf_folders_copy_controller.rb b/app/controllers/dmsf_folders_copy_controller.rb
index dde421a5..3b53ae82 100644
--- a/app/controllers/dmsf_folders_copy_controller.rb
+++ b/app/controllers/dmsf_folders_copy_controller.rb
@@ -69,15 +69,8 @@ class DmsfFoldersCopyController < ApplicationController
flash[:notice] = l(:notice_folder_copied)
log_activity(new_folder, 'was copied (is copy)')
-
- #TODO: implement proper notification for all new files
- #begin
- # DmsfMailer.files_updated(User.current, [new_file]).deliver
- #rescue ActionView::MissingTemplate => e
- # Rails.logger.error "Could not send email notifications: " + e
- #end
-
- redirect_to :controller => 'dmsf', :action => 'show', :id => @target_project, :folder_id => new_folder
+
+ redirect_to dmsf_folder_path(:id => @target_project, :folder_id => new_folder)
end
private
diff --git a/app/controllers/dmsf_links_controller.rb b/app/controllers/dmsf_links_controller.rb
new file mode 100644
index 00000000..92beba27
--- /dev/null
+++ b/app/controllers/dmsf_links_controller.rb
@@ -0,0 +1,170 @@
+# Redmine plugin for Document Management System "Features"
+#
+# Copyright (C) 2011-14 Karel Pičman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class DmsfLinksController < ApplicationController
+ unloadable
+
+ model_object DmsfLink
+ before_filter :find_model_object, :only => [:destroy]
+ before_filter :find_link_project
+ before_filter :authorize
+
+ def new
+ @dmsf_link = DmsfLink.new(:project_id => params[:project_id])
+
+ if params[:dmsf_link].present?
+ # Reload
+ @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id]
+ @dmsf_file_id = params[:dmsf_link][:dmsf_file_id]
+ @type = params[:dmsf_link][:type]
+ @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id]
+ @target_folder_id = params[:dmsf_link][:target_folder_id].to_i if params[:reload].blank? && DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id])
+ if @type == 'link_to'
+ if params[:dmsf_link][:dmsf_file_id].present?
+ file = DmsfFile.find_by_id params[:dmsf_link][:dmsf_file_id]
+ @dmsf_link.name = file.title if file
+ else
+ folder = DmsfFolder.find_by_id params[:dmsf_link][:dmsf_folder_id]
+ @dmsf_link.name = folder.title if folder
+ end
+ else
+ if params[:dmsf_link][:target_file_id].present?
+ @target_file_id = params[:dmsf_link][:target_file_id]
+ file = DmsfFile.find_by_id @target_file_id
+
+ if file
+ folder = DmsfFolder.find_by_id params[:dmsf_link][:target_folder_id]
+ if (folder && (folder.project_id == @dmsf_link.target_project_id) && folder.files.include?(file)) || folder.nil?
+ @dmsf_link.name = file.title
+ end
+ end
+ else
+ folder = DmsfFolder.find_by_id params[:dmsf_link][:target_folder_id]
+
+ if folder
+ if folder.project_id == @dmsf_link.target_project_id
+ @dmsf_link.name = folder.title if folder
+ end
+ end
+ end
+ end
+ else
+ # Link from/to
+ @dmsf_link.dmsf_folder_id = params[:dmsf_folder_id]
+ @dmsf_file_id = params[:dmsf_file_id]
+ @type = params[:type]
+ @dmsf_link.target_project_id = params[:project_id]
+ @target_folder_id = params[:dmsf_folder_id].to_i if params[:dmsf_folder_id].present?
+ if @type == 'link_to'
+ if @dmsf_file_id
+ file = DmsfFile.find_by_id @dmsf_file_id
+ @dmsf_link.name = file.title if file
+ else
+ folder = DmsfFolder.find_by_id @target_folder_id
+ @dmsf_link.name = folder.title if folder
+ end
+ end
+ end
+
+ render :layout => !request.xhr?
+ end
+
+ def create
+ @dmsf_link = DmsfLink.new
+
+ if params[:dmsf_link][:type] == 'link_from'
+ # Link from
+ @dmsf_link.project_id = params[:dmsf_link][:project_id]
+ @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id]
+ @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id]
+ if params[:dmsf_link][:target_file_id].present?
+ @dmsf_link.target_id = params[:dmsf_link][:target_file_id]
+ @dmsf_link.target_type = DmsfFile.model_name
+ else
+ @dmsf_link.target_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil
+ @dmsf_link.target_type = DmsfFolder.model_name
+ end
+ @dmsf_link.name = params[:dmsf_link][:name]
+
+ if @dmsf_link.save
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to dmsf_folder_path(:id => @project.id, :folder_id => @dmsf_link.dmsf_folder_id)
+ else
+ @dmsf_file_id = params[:dmsf_link][:dmsf_file_id]
+ @type = params[:dmsf_link][:type]
+ @target_folder_id = params[:dmsf_link][:target_folder_id].to_i if DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id])
+ @target_file_id = @dmsf_link.target_id if @dmsf_link.target_type == DmsfFile.model_name
+ render :action => 'new'
+ end
+ else
+ # Link to
+ @dmsf_link.project_id = params[:dmsf_link][:target_project_id]
+ @dmsf_link.dmsf_folder_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil
+ @dmsf_link.target_project_id = params[:dmsf_link][:project_id]
+ if params[:dmsf_link][:dmsf_file_id].present?
+ @dmsf_link.target_id = params[:dmsf_link][:dmsf_file_id]
+ @dmsf_link.target_type = DmsfFile.model_name
+ else
+ @dmsf_link.target_id = params[:dmsf_link][:dmsf_folder_id]
+ @dmsf_link.target_type = DmsfFolder.model_name
+ end
+ @dmsf_link.name = params[:dmsf_link][:name]
+
+ if @dmsf_link.save
+ flash[:notice] = l(:notice_successful_create)
+ if params[:dmsf_link][:dmsf_file_id].present?
+ redirect_to dmsf_file_path(@dmsf_link.target_file)
+ else
+ redirect_to edit_dmsf_path(:id => params[:dmsf_link][:project_id], :folder_id => params[:dmsf_link][:dmsf_folder_id])
+ end
+ else
+ @dmsf_file_id = params[:dmsf_link][:dmsf_file_id]
+ @type = params[:dmsf_link][:type]
+ @target_folder_id = @dmsf_link.dmsf_folder_id
+ @dmsf_link.target_project_id = @dmsf_link.project.id
+ @dmsf_link.project_id = params[:dmsf_link][:project_id]
+ @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id]
+ render :action => 'new'
+ end
+ end
+ end
+
+ def destroy
+ begin
+ @dmsf_link.destroy
+ flash[:notice] = l(:notice_successful_delete)
+ rescue
+ flash[:error] = l(:error_unable_delete_dmsf_workflow)
+ end
+
+ redirect_to :back
+ end
+
+ private
+
+ def find_link_project
+ if @dmsf_link
+ @project = @dmsf_link.project
+ else
+ @project = Project.find(params[:dmsf_link].present? ? params[:dmsf_link][:project_id] : params[:project_id])
+ end
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+end
\ No newline at end of file
diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb
index 69b6bc52..19eaf5e9 100644
--- a/app/controllers/dmsf_state_controller.rb
+++ b/app/controllers/dmsf_state_controller.rb
@@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -22,32 +23,18 @@ class DmsfStateController < ApplicationController
menu_item :dmsf
before_filter :find_project
- before_filter :authorize
-
- helper :all
+ before_filter :authorize
def user_pref_save
- member = @project.members.find(:first, :conditions => {:user_id => User.current.id})
+ member = @project.members.where(:user_id => User.current.id).first
if member
- member.dmsf_mail_notification = params[:email_notify];
+ member.dmsf_mail_notification = params[:email_notify]
member.save!
flash[:notice] = l(:notice_your_preferences_were_saved)
else
flash[:warning] = l(:user_is_not_project_member)
- end
- redirect_to :controller => 'projects', :action => 'settings', :tab => 'dmsf', :id => @project
+ end
+ redirect_to settings_project_path(@project, :tab => 'dmsf')
end
-
- private
-
- def find_project
- @project = Project.find(params[:id])
- end
-
- def check_project(entry)
- if entry && entry.project != @project
- raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
- end
- end
-
-end
+
+end
\ No newline at end of file
diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb
index 1109e28e..fa1e0347 100644
--- a/app/controllers/dmsf_upload_controller.rb
+++ b/app/controllers/dmsf_upload_controller.rb
@@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2014 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -77,25 +78,28 @@ class DmsfUploadController < ApplicationController
render :layout => false
end
end
-
- #TODO: flash notice when files saved and unlocked
- #TODO: separate control for approval
+
def commit_files
commited_files = params[:commited_files]
if commited_files && commited_files.is_a?(Hash)
files = []
failed_uploads = []
commited_files.each_value do |commited_file|
- name = commited_file['name'];
+ name = commited_file[:name]
new_revision = DmsfFileRevision.new
file = DmsfFile.visible.find_file_by_name(@project, @folder, name)
- if file.nil?
+ unless file
+ link = DmsfLink.find_link_by_file_name(@project, @folder, name)
+ file = link.target_file if link
+ end
+
+ unless file
file = DmsfFile.new
file.project = @project
file.name = name
file.folder = @folder
- file.notification = Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present?
+ file.notification = Setting.plugin_redmine_dmsf[:dmsf_default_notifications].present?
new_revision.minor_version = 0
new_revision.major_version = 0
@@ -110,17 +114,17 @@ class DmsfUploadController < ApplicationController
new_revision.minor_version = last_revision.minor_version
end
- commited_disk_filepath = "#{DmsfHelper.temp_dir}/#{commited_file['disk_filename'].gsub(/[\/\\]/,'')}"
+ commited_disk_filepath = "#{DmsfHelper.temp_dir}/#{commited_file[:disk_filename].gsub(/[\/\\]/,'')}"
- new_revision.project = @project
- new_revision.folder = @folder
+ new_revision.project = link ? link.target_project : @project
+ new_revision.folder = link ? link.target_folder : @folder
new_revision.file = file
new_revision.user = User.current
new_revision.name = name
- new_revision.title = commited_file['title']
- new_revision.description = commited_file['description']
- new_revision.comment = commited_file['comment']
- new_revision.increase_version(commited_file['version'].to_i, true)
+ new_revision.title = commited_file[:title]
+ new_revision.description = commited_file[:description]
+ new_revision.comment = commited_file[:comment]
+ new_revision.increase_version(commited_file[:version].to_i, true)
new_revision.mime_type = Redmine::MimeType.of(new_revision.name)
new_revision.size = File.size(commited_disk_filepath)
@@ -142,7 +146,13 @@ class DmsfUploadController < ApplicationController
end
# Need to save file first to generate id for it in case of creation.
- # File id is needed to properly generate revision disk filename
+ # File id is needed to properly generate revision disk filename
+ if commited_file[:dmsf_file_revision].present?
+ commited_file[:dmsf_file_revision][:custom_field_values].each_with_index do |v, i|
+ new_revision.custom_field_values[i].value = v[1]
+ end
+ end
+
if new_revision.valid? && file.save
new_revision.disk_filename = new_revision.new_storage_filename
else
@@ -151,33 +161,31 @@ class DmsfUploadController < ApplicationController
end
if new_revision.save
- new_revision.assign_workflow(commited_file[:dmsf_workflow_id])
- file.reload
-
+ new_revision.assign_workflow(commited_file[:dmsf_workflow_id])
new_revision.copy_file_content(file_upload)
file_upload.close
- File.delete(commited_disk_filepath)
-
+ File.delete(commited_disk_filepath)
+ file.set_last_revision new_revision
files.push(file)
-
- if commited_file['dmsf_file_revision'].present?
- commited_file['dmsf_file_revision']['custom_field_values'].each do |v|
- cv = CustomValue.where(:customized_id => new_revision.id, :custom_field_id => v[0]).first
- if cv
- cv.value = v[1]
- cv.save
- end
- end
- end
else
failed_uploads.push(commited_file)
end
end
- unless files.empty?
- files.each { |file| log_activity(file, 'uploaded') if file }
- begin
- DmsfMailer.files_updated(User.current, files).deliver
- rescue ActionView::MissingTemplate => e
+ unless files.empty?
+ files.each { |file| log_activity(file, 'uploaded') if file }
+ begin
+ recipients = DmsfMailer.get_notify_users(User.current, files)
+ recipients.each do |u|
+ DmsfMailer.files_updated(u, @project, files).deliver
+ end
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
+ end
+ rescue Exception => e
Rails.logger.error "Could not send email notifications: #{e.message}"
end
end
@@ -185,7 +193,7 @@ class DmsfUploadController < ApplicationController
flash[:warning] = l(:warning_some_files_were_not_commited, :files => failed_uploads.map{|u| u['name']}.join(', '))
end
end
- redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
+ redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder)
end
private
@@ -193,22 +201,11 @@ class DmsfUploadController < ApplicationController
def log_activity(file, action)
Rails.logger.info "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} #{User.current.login}@#{request.remote_ip}/#{request.env['HTTP_X_FORWARDED_FOR']}: #{action} dmsf://#{file.project.identifier}/#{file.id}/#{file.last_revision.id}"
end
-
- def find_project
- @project = Project.find(params[:id])
- end
-
+
def find_folder
- @folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?('folder_id')
- check_project(@folder)
+ @folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?('folder_id')
rescue DmsfAccessError
render_403
end
-
- def check_project(entry)
- if entry && entry.project != @project
- raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
- end
- end
-
-end
+
+end
\ No newline at end of file
diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb
index 1e8aae9c..b874ef29 100644
--- a/app/controllers/dmsf_workflows_controller.rb
+++ b/app/controllers/dmsf_workflows_controller.rb
@@ -1,6 +1,6 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2013 Karel Picman
+# Copyright (C) 2011-14 Karel Picman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -17,13 +17,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DmsfWorkflowsController < ApplicationController
- unloadable
- layout :workflows_layout
+ unloadable
+ model_object DmsfWorkflow
+
+ before_filter :find_model_object, :except => [:create, :new, :index, :assign, :assignment]
+ before_filter :find_project
+ before_filter :authorize_custom
- before_filter :find_workflow, :except => [:create, :new, :index, :assign, :assignment]
- before_filter :find_project, :except => [:start]
- before_filter :authorize_global
- before_filter :authorize_custom, :except => [:assignment, :start, :new_action]
+ layout :workflows_layout
def index
if @project
@@ -46,7 +47,7 @@ class DmsfWorkflowsController < ApplicationController
if action.save
revision = DmsfFileRevision.find_by_id params[:dmsf_file_revision_id]
if revision
- if @workflow.try_finish revision, action, (params[:step_action].to_i / 10)
+ if @dmsf_workflow.try_finish revision, action, (params[:step_action].to_i / 10)
file = DmsfFile.joins(:revisions).where(:dmsf_file_revisions => {:id => revision.id}).first
if file
begin
@@ -57,64 +58,106 @@ class DmsfWorkflowsController < ApplicationController
end
if revision.workflow == DmsfWorkflow::STATE_APPROVED
# Just approved
- revision.file.project.members.each do |member|
+ recipients = revision.file.project.members.collect{ |m| m.user }
+ if User.current && User.current.logged? && User.current.pref.no_self_notified
+ recipients.delete User.current
+ end
+ recipients.each do |user|
DmsfMailer.workflow_notification(
- member.user,
- @workflow,
+ user,
+ @dmsf_workflow,
revision,
- l(:text_email_subject_approved, :name => @workflow.name),
- l(:text_email_finished_approved, :name => @workflow.name, :filename => revision.file.name),
- l(:text_email_to_see_history)).deliver if member.user
+ :text_email_subject_approved,
+ :text_email_finished_approved,
+ :text_email_to_see_history).deliver if user
+ end
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ recipients = revision.file.project.members.collect{ |m| m.user }
+ if User.current && User.current.logged? && User.current.pref.no_self_notified
+ recipients.delete User.current
+ end
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
end
else
# Just rejected
- recipients = @workflow.participiants
+ recipients = @dmsf_workflow.participiants
recipients.push User.find_by_id revision.dmsf_workflow_assigned_by
+ recipients.uniq!
+ if User.current && User.current.logged? && User.current.pref.no_self_notified
+ recipients.delete User.current
+ end
recipients.each do |user|
DmsfMailer.workflow_notification(
user,
- @workflow,
+ @dmsf_workflow,
revision,
- l(:text_email_subject_rejected, :name => @workflow.name),
- l(:text_email_finished_rejected, :name => @workflow.name, :filename => revision.file.name, :notice => action.note),
- l(:text_email_to_see_history)).deliver if user
+ :text_email_subject_rejected,
+ :text_email_finished_rejected,
+ :text_email_to_see_history,
+ action.note).deliver if user
+ end
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
end
end
else
if action.action == DmsfWorkflowStepAction::ACTION_DELEGATE
# Delegation
- delegate = User.find_by_id params[:step_action].to_i / 10
- DmsfMailer.workflow_notification(
- delegate,
- @workflow,
- revision,
- l(:text_email_subject_delegated, :name => @workflow.name),
- l(:text_email_finished_delegated, :name => @workflow.name, :filename => revision.file.name, :notice => action.note),
- l(:text_email_to_proceed)).deliver if delegate
+ delegate = User.find_by_id params[:step_action].to_i / 10
+ if delegate
+ DmsfMailer.workflow_notification(
+ delegate,
+ @dmsf_workflow,
+ revision,
+ :text_email_subject_delegated,
+ :text_email_finished_delegated,
+ :text_email_to_proceed,
+ action.note).deliver
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ flash[:warning] = l(:warning_email_notifications, :to => delegate.name)
+ end
+ end
else
# Next step
- assignments = @workflow.next_assignments revision.id
+ assignments = @dmsf_workflow.next_assignments revision.id
unless assignments.empty?
if assignments.first.dmsf_workflow_step.step != action.dmsf_workflow_step_assignment.dmsf_workflow_step.step
# Next step
assignments.each do |assignment|
DmsfMailer.workflow_notification(
assignment.user,
- @workflow,
+ @dmsf_workflow,
revision,
- l(:text_email_subject_requires_approval, :name => @workflow.name),
- l(:text_email_finished_step, :name => @workflow.name, :filename => revision.file.name),
- l(:text_email_to_proceed)).deliver if assignment.user
+ :text_email_subject_requires_approval,
+ :text_email_finished_step,
+ :text_email_to_proceed).deliver if assignment.user
end
to = User.find_by_id revision.dmsf_workflow_assigned_by
DmsfMailer.workflow_notification(
to,
- @workflow,
+ @dmsf_workflow,
revision,
- l(:text_email_subject_updated, :name => @workflow.name),
- l(:text_email_finished_step_short, :name => @workflow.name, :filename => revision.file.name),
- l(:text_email_to_see_status)).deliver if to
- end
+ :text_email_subject_updated,
+ :text_email_finished_step_short,
+ :text_email_to_see_status).deliver if to
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ recipients = assignments.collect{ |a| a.user }
+ recipients << to if to && !recipients.include?(to)
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
+ end
+ end
end
end
end
@@ -163,12 +206,12 @@ class DmsfWorkflowsController < ApplicationController
end
def new
- @workflow = DmsfWorkflow.new
+ @dmsf_workflow = DmsfWorkflow.new
end
def create
- @workflow = DmsfWorkflow.new(:name => params[:name], :project_id => params[:project_id])
- if request.post? && @workflow.save
+ @dmsf_workflow = DmsfWorkflow.new(:name => params[:name], :project_id => params[:project_id])
+ if request.post? && @dmsf_workflow.save
flash[:notice] = l(:notice_successful_create)
if @project
redirect_to settings_project_path(@project, :tab => 'dmsf_workflow')
@@ -180,11 +223,8 @@ class DmsfWorkflowsController < ApplicationController
end
end
- def edit
- end
-
def update
- if request.put? && @workflow.update_attributes({:name => params[:name]})
+ if request.put? && @dmsf_workflow.update_attributes({:name => params[:name]})
flash[:notice] = l(:notice_successful_update)
if @project
redirect_to settings_project_path(@project, :tab => 'dmsf_workflow')
@@ -198,7 +238,7 @@ class DmsfWorkflowsController < ApplicationController
def destroy
begin
- @workflow.destroy
+ @dmsf_workflow.destroy
flash[:notice] = l(:notice_successful_delete)
rescue
flash[:error] = l(:error_unable_delete_dmsf_workflow)
@@ -218,14 +258,14 @@ class DmsfWorkflowsController < ApplicationController
if request.post?
users = User.find_all_by_id(params[:user_ids])
if params[:step] == '0'
- step = @workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq.count + 1
+ step = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq.count + 1
else
step = params[:step].to_i
end
operator = (params[:commit] == l(:dmsf_and)) ? DmsfWorkflowStep::OPERATOR_AND : DmsfWorkflowStep::OPERATOR_OR
users.each do |user|
- @workflow.dmsf_workflow_steps << DmsfWorkflowStep.new(
- :dmsf_workflow_id => @workflow.id,
+ @dmsf_workflow.dmsf_workflow_steps << DmsfWorkflowStep.new(
+ :dmsf_workflow_id => @dmsf_workflow.id,
:step => step,
:user_id => user.id,
:operator => operator)
@@ -238,10 +278,10 @@ class DmsfWorkflowsController < ApplicationController
def remove_step
if request.delete?
- DmsfWorkflowStep.where(:dmsf_workflow_id => @workflow.id, :step => params[:step]).each do |ws|
- @workflow.dmsf_workflow_steps.delete(ws)
+ DmsfWorkflowStep.where(:dmsf_workflow_id => @dmsf_workflow.id, :step => params[:step]).each do |ws|
+ @dmsf_workflow.dmsf_workflow_steps.delete(ws)
end
- @workflow.dmsf_workflow_steps.each do |ws|
+ @dmsf_workflow.dmsf_workflow_steps.each do |ws|
n = ws.step.to_i
if n > params[:step].to_i
ws.step = n - 1
@@ -258,7 +298,7 @@ class DmsfWorkflowsController < ApplicationController
def reorder_steps
if request.put?
- unless @workflow.reorder_steps(params[:step].to_i, params[:workflow_step][:move_to])
+ unless @dmsf_workflow.reorder_steps(params[:step].to_i, params[:workflow_step][:move_to])
flash[:error] = l(:notice_cannot_renumber_steps)
end
end
@@ -269,49 +309,67 @@ class DmsfWorkflowsController < ApplicationController
def start
revision = DmsfFileRevision.find_by_id(params[:dmsf_file_revision_id])
- if revision
- if request.post?
- revision.set_workflow(@workflow.id, params[:action])
- if revision.save
- assignments = @workflow.next_assignments revision.id
- assignments.each do |assignment|
- DmsfMailer.workflow_notification(
- assignment.user,
- @workflow,
- revision,
- l(:text_email_subject_started, :name => @workflow.name),
- l(:text_email_started, :name => @workflow.name, :filename => revision.file.name),
- l(:text_email_to_proceed)).deliver if assignment.user
- end
- flash[:notice] = l(:notice_workflow_started)
- else
- flash[:error] = l(:notice_cannot_start_workflow)
+ if revision
+ revision.set_workflow(@dmsf_workflow.id, params[:action])
+ if revision.save
+ assignments = @dmsf_workflow.next_assignments revision.id
+ assignments.each do |assignment|
+ DmsfMailer.workflow_notification(
+ assignment.user,
+ @dmsf_workflow,
+ revision,
+ :text_email_subject_started,
+ :text_email_started,
+ :text_email_to_proceed).deliver if assignment.user
end
- end
+ if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1'
+ recipients = assignments.collect { |a| a.user }
+ recipients.uniq!
+ if User.current && User.current.logged? && User.current.pref.no_self_notified
+ recipients.delete User.current
+ end
+ unless recipients.empty?
+ to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
+ to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
+ flash[:warning] = l(:warning_email_notifications, :to => to)
+ end
+ end
+ flash[:notice] = l(:notice_workflow_started)
+ else
+ flash[:error] = l(:notice_cannot_start_workflow)
+ end
end
redirect_to :back
end
private
- def find_workflow
- @workflow = DmsfWorkflow.find_by_id(params[:id])
- end
-
+
def find_project
- if @workflow && @workflow.project
- @project = @workflow.project
- elsif params[:project_id].present?
- @project = Project.find_by_id params[:project_id]
+ if @dmsf_workflow
+ if @dmsf_workflow.project # Project workflow
+ @project = @dmsf_workflow.project
+ else # Global workflow
+ revision = DmsfFileRevision.find_by_id params[:dmsf_file_revision_id]
+ @project = revision.project if revision
+ end
+ else
+ if params[:project_id].present?
+ @project = Project.find_by_id params[:project_id]
+ else
+ @project = Project.find_by_identifier params[:id]
+ end
end
end
- def workflows_layout
- find_workflow
- find_project
+ def workflows_layout
@project ? 'base' : 'admin'
end
- def authorize_custom
- require_admin unless @project
+ def authorize_custom
+ if @project
+ authorize
+ else
+ require_admin
+ end
end
-end
+end
\ No newline at end of file
diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb
index 08f28bf0..e06e403d 100644
--- a/app/helpers/dmsf_helper.rb
+++ b/app/helpers/dmsf_helper.rb
@@ -74,6 +74,6 @@ module DmsfHelper
# of methods - however seems functional. Not sure if MySQL
return obj.to_s.to_time(ActiveRecord::Base.default_timezone) if obj.class.name == 'Mysql::Time'
return obj
- end
+ end
end
diff --git a/app/helpers/dmsf_links_helper.rb b/app/helpers/dmsf_links_helper.rb
new file mode 100644
index 00000000..9a1a89a7
--- /dev/null
+++ b/app/helpers/dmsf_links_helper.rb
@@ -0,0 +1,40 @@
+# Redmine plugin for Document Management System "Features"
+#
+# Copyright (C) 2014 Karel Pičman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+module DmsfLinksHelper
+
+ def folder_tree_options_for_select(folder_tree, options = {})
+ s = ''
+ folder_tree.each do |name, id|
+ tag_options = {:value => id}
+ if id == options[:selected]
+ tag_options[:selected] = 'selected'
+ else
+ tag_options[:selected] = nil
+ end
+ s << content_tag('option', name, tag_options)
+ end
+ s.html_safe
+ end
+
+ # An integer test
+ def self.is_a_number?(s)
+ s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
+ end
+
+end
diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb
index 221bb126..8d591f05 100644
--- a/app/models/dmsf_file.rb
+++ b/app/models/dmsf_file.rb
@@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -31,14 +32,16 @@ class DmsfFile < ActiveRecord::Base
belongs_to :project
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id'
+ belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
has_many :revisions, :class_name => 'DmsfFileRevision', :foreign_key => 'dmsf_file_id',
:order => "#{DmsfFileRevision.table_name}.major_version DESC, #{DmsfFileRevision.table_name}.minor_version DESC, #{DmsfFileRevision.table_name}.updated_at DESC",
:dependent => :destroy
has_many :locks, :class_name => 'DmsfLock', :foreign_key => 'entity_id',
:order => "#{DmsfLock.table_name}.updated_at DESC",
:conditions => {:entity_type => 0},
- :dependent => :destroy
- belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
+ :dependent => :destroy
+ has_many :referenced_links, :class_name => 'DmsfLink', :foreign_key => 'target_id',
+ :conditions => {:target_type => DmsfFile.model_name}, :dependent => :destroy
scope :visible, lambda {|*args| where(DmsfFile.visible_condition(args.shift || User.current, *args)).readonly(false)}
@@ -64,14 +67,15 @@ class DmsfFile < ActiveRecord::Base
:url => Proc.new {|o| {:controller => 'dmsf_files', :action => 'show', :id => o}},
:datetime => Proc.new {|o| o.updated_at },
:author => Proc.new {|o| o.last_revision.user }
-
-
- @@storage_path = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip
+
+ @@storage_path = nil
def self.storage_path
- if !File.exists?(@@storage_path)
- Dir.mkdir(@@storage_path)
- end
+ unless @@storage_path.present?
+ @@storage_path = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip
+ @@storage_path = Rails.root.join('files/dmsf').to_s if @@storage_path.blank?
+ Dir.mkdir(@@storage_path) unless File.exists?(@@storage_path)
+ end
@@storage_path
end
@@ -81,16 +85,11 @@ class DmsfFile < ActiveRecord::Base
@@storage_path = obj
end
- def self.project_root_files(project)
- visible.where(:project_id => project.id, :dmsf_folder_id => nil).order('name ASC')
- end
-
- def self.find_file_by_name(project, folder, name)
- if folder
- visible.where(:project_id => project, :dmsf_folder_id => folder.id, :name => name).first
- else
- visible.where(:project_id => project, :dmsf_folder_id => nil, :name => name).first
- end
+ def self.find_file_by_name(project, folder, name)
+ where(
+ :project_id => project,
+ :dmsf_folder_id => folder ? folder.id : nil,
+ :name => name).visible.first
end
def last_revision
@@ -99,14 +98,19 @@ class DmsfFile < ActiveRecord::Base
end
@last_revision
end
+
+ def set_last_revision(new_revision)
+ @last_revision = new_revision
+ end
def delete
if locked_for_user?
+ Rails.logger.info l(:error_file_is_locked)
errors[:base] << l(:error_file_is_locked)
return false
end
begin
- if Setting.plugin_redmine_dmsf['dmsf_really_delete_files']
+ if Setting.plugin_redmine_dmsf['dmsf_really_delete_files']
self.revisions.visible.each {|r| r.delete(true)}
self.destroy
else
@@ -167,11 +171,7 @@ class DmsfFile < ActiveRecord::Base
def notify_activate
self.notification = true
self.save!
- end
-
- def display_name
- return self.name
- end
+ end
# Returns an array of projects that current user can copy file to
def self.allowed_target_projects_on_copy
@@ -190,7 +190,7 @@ class DmsfFile < ActiveRecord::Base
return false
end
- new_revision = self.last_revision.clone
+ new_revision = self.last_revision.clone
new_revision.folder = folder
new_revision.project = folder ? folder.project : project
@@ -201,10 +201,10 @@ class DmsfFile < ActiveRecord::Base
new_revision.custom_values << CustomValue.new({:custom_field => cv.custom_field, :value => cv.value})
end
- # If the target project differs from the source project we must physically move the file
+ # If the target project differs from the source project we must physically copy the file
if self.project != new_revision.project
if File.exist? self.last_revision.disk_file
- FileUtils.mv self.last_revision.disk_file, new_revision.disk_file
+ FileUtils.cp self.last_revision.disk_file, new_revision.disk_file
end
end
@@ -221,9 +221,8 @@ class DmsfFile < ActiveRecord::Base
file.name = self.name
file.notification = Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present?
- if file.save
+ if file.save && self.last_revision
new_revision = self.last_revision.clone
-
new_revision.file = file
new_revision.folder = folder
new_revision.project = folder ? folder.project : project
@@ -376,4 +375,11 @@ class DmsfFile < ActiveRecord::Base
[results, results_count]
end
+ def display_name
+ if self.name.length > 50
+ return "#{self.name[0, 25]}...#{self.name[-25, 25]}"
+ end
+ self.name
+ end
+
end
diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb
index 42a4b479..3ab0f8ea 100644
--- a/app/models/dmsf_file_revision.rb
+++ b/app/models/dmsf_file_revision.rb
@@ -33,21 +33,21 @@ class DmsfFileRevision < ActiveRecord::Base
acts_as_customizable
acts_as_event :title => Proc.new {|o| "#{l(:label_dmsf_updated)}: #{o.file.dmsf_path_str}"},
- :url => Proc.new {|o| {:controller => 'dmsf_files', :action => 'show', :id => o.file}},
- :datetime => Proc.new {|o| o.updated_at },
- :description => Proc.new {|o| o.comment },
- :author => Proc.new {|o| o.user }
+ :url => Proc.new {|o| {:controller => 'dmsf_files', :action => 'show', :id => o.file}},
+ :datetime => Proc.new {|o| o.updated_at },
+ :description => Proc.new {|o| o.comment },
+ :author => Proc.new {|o| o.user }
acts_as_activity_provider :type => 'dmsf_files',
- :timestamp => "#{DmsfFileRevision.table_name}.updated_at",
- :author_key => "#{DmsfFileRevision.table_name}.user_id",
- :permission => :view_dmsf_files,
- :find_options => {:select => "#{DmsfFileRevision.table_name}.*",
- :joins =>
- "INNER JOIN #{DmsfFile.table_name} ON #{DmsfFileRevision.table_name}.dmsf_file_id = #{DmsfFile.table_name}.id " +
- "INNER JOIN #{Project.table_name} ON #{DmsfFile.table_name}.project_id = #{Project.table_name}.id",
- :conditions => ["#{DmsfFile.table_name}.deleted = :false", {:false => false}]
- }
+ :timestamp => "#{DmsfFileRevision.table_name}.updated_at",
+ :author_key => "#{DmsfFileRevision.table_name}.user_id",
+ :permission => :view_dmsf_files,
+ :find_options => {:select => "#{DmsfFileRevision.table_name}.*",
+ :joins =>
+ "INNER JOIN #{DmsfFile.table_name} ON #{DmsfFileRevision.table_name}.dmsf_file_id = #{DmsfFile.table_name}.id " +
+ "INNER JOIN #{Project.table_name} ON #{DmsfFile.table_name}.project_id = #{Project.table_name}.id",
+ :conditions => ["#{DmsfFile.table_name}.deleted = :false", {:false => false}]
+ }
validates :title, :name, :presence => true
validates_format_of :name, :with => DmsfFolder.invalid_characters,
@@ -56,8 +56,7 @@ class DmsfFileRevision < ActiveRecord::Base
def self.remove_extension(filename)
filename[0, (filename.length - File.extname(filename).length)]
end
-
- # TODO: check if better to move to dmsf_upload class
+
def self.filename_to_title(filename)
remove_extension(filename).gsub(/_+/, ' ');
end
@@ -130,8 +129,7 @@ class DmsfFileRevision < ActiveRecord::Base
content_type = 'application/octet-stream' if content_type.blank?
content_type.to_s
end
-
- # TODO: use standard clone method
+
def clone
new_revision = DmsfFileRevision.new
new_revision.file = self.file
@@ -205,11 +203,7 @@ class DmsfFileRevision < ActiveRecord::Base
when 2 then self.major_version + 1
else self.major_version
end
- end
-
- def display_title
- return self.title
- end
+ end
def new_storage_filename
raise DmsfAccessError, 'File id is not set' unless self.file.id
@@ -233,5 +227,10 @@ class DmsfFileRevision < ActiveRecord::Base
def available_custom_fields
DmsfFileRevisionCustomField.all
end
+
+ def iversion
+ parts = self.version.split '.'
+ parts.size == 2 ? parts[0].to_i * 1000 + parts[1].to_i : 0
+ end
end
diff --git a/app/models/dmsf_file_revision_custom_field.rb b/app/models/dmsf_file_revision_custom_field.rb
index 9f6b564a..2793b424 100644
--- a/app/models/dmsf_file_revision_custom_field.rb
+++ b/app/models/dmsf_file_revision_custom_field.rb
@@ -18,7 +18,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DmsfFileRevisionCustomField < CustomField
+
def type_name
:menu_dmsf
end
+
+ def compare_values?(x, y)
+ if x.is_a?(Array) && y.is_a?(Array) && !y.empty?
+ x.include? y[0]
+ else
+ x == y
+ end
+ end
+
end
\ No newline at end of file
diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb
index 0869505e..23011c42 100644
--- a/app/models/dmsf_folder.rb
+++ b/app/models/dmsf_folder.rb
@@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -26,18 +27,23 @@ class DmsfFolder < ActiveRecord::Base
belongs_to :project
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id'
- has_many :subfolders, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id', :order => "#{DmsfFolder.table_name}.title ASC",
- :dependent => :destroy
- has_many :files, :class_name => 'DmsfFile', :foreign_key => 'dmsf_folder_id',
- :dependent => :destroy
+ has_many :subfolders, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id',
+ :dependent => :destroy
+ has_many :files, :class_name => 'DmsfFile', :foreign_key => 'dmsf_folder_id',
+ :dependent => :destroy
belongs_to :user
-
+ has_many :folder_links, :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id',
+ :conditions => {:target_type => DmsfFolder.model_name}, :dependent => :destroy
+ has_many :file_links, :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id',
+ :conditions => {:target_type => DmsfFile.model_name}, :dependent => :destroy
+ has_many :referenced_links, :class_name => 'DmsfLink', :foreign_key => 'target_id',
+ :conditions => {:target_type => DmsfFolder.model_name}, :dependent => :destroy
has_many :locks, :class_name => 'DmsfLock', :foreign_key => 'entity_id',
:order => "#{DmsfLock.table_name}.updated_at DESC",
:conditions => {:entity_type => 1},
:dependent => :destroy
- scope :visible, lambda {|*args| {:conditions => '' }} #For future use, however best to be referenced now
+ scope :visible, lambda {|*args| {:conditions => '' }} #For future use, however best to be referenced now
acts_as_customizable
@@ -68,10 +74,6 @@ class DmsfFolder < ActiveRecord::Base
return true
end
- def self.project_root_folders(project)
- visible.where(:project_id => project.id, :dmsf_folder_id => nil, ).order('title ASC').all
- end
-
def self.find_by_title(project, folder, title)
if folder
visible.where(:project_id => project.id, :dmsf_folder_id => nil, :title => title).first
@@ -126,27 +128,42 @@ class DmsfFolder < ActiveRecord::Base
def self.directory_tree(project, current_folder = nil)
tree = [[l(:link_documents), nil]]
- DmsfFolder.visible.project_root_folders(project).each do |folder|
+ project.dmsf_folders.visible.each do |folder|
unless folder == current_folder
tree.push(["...#{folder.title}", folder.id])
directory_subtree(tree, folder, 2, current_folder)
end
end
return tree
- end
+ end
+
+ def folder_tree
+ tree = [[self.title, self.id]]
+ DmsfFolder.directory_subtree(tree, self, 2, nil)
+ return tree
+ end
+
+ def self.file_list(files)
+ options = Array.new
+ options.push ['', nil]
+ files.each do |f|
+ options.push [f.title, f.id]
+ end
+ options
+ end
def deep_file_count
file_count = self.files.visible.count
self.subfolders.visible.each {|subfolder| file_count += subfolder.deep_file_count}
- file_count
+ file_count + self.file_links.visible.count
end
def deep_folder_count
folder_count = self.subfolders.visible.count
self.subfolders.visible.each {|subfolder| folder_count += subfolder.deep_folder_count}
- folder_count
- end
-
+ folder_count + self.folder_links.visible.count
+ end
+
def deep_size
size = 0
self.files.visible.each {|file| size += file.size}
@@ -181,11 +198,19 @@ class DmsfFolder < ActiveRecord::Base
return new_folder unless new_folder.save
self.files.visible.each do |f|
- f.copy_to(project, new_folder)
+ f.copy_to project, new_folder
end
- self.subfolders.each do |s|
- s.copy_to(project, new_folder)
+ self.subfolders.visible.each do |s|
+ s.copy_to project, new_folder
+ end
+
+ self.folder_links.visible.each do |l|
+ l.copy_to project, new_folder
+ end
+
+ self.file_links.visible.each do |l|
+ l.copy_to project, new_folder
end
return new_folder
@@ -239,7 +264,7 @@ class DmsfFolder < ActiveRecord::Base
def self.directory_subtree(tree, folder, level, current_folder)
folder.subfolders.visible.each do |subfolder|
unless subfolder == current_folder
- tree.push(["#{"..." * level}#{subfolder.title}", subfolder.id])
+ tree.push(["#{'...' * level}#{subfolder.title}", subfolder.id])
directory_subtree(tree, subfolder, level + 1, current_folder)
end
end
diff --git a/app/models/dmsf_link.rb b/app/models/dmsf_link.rb
new file mode 100644
index 00000000..a216fed1
--- /dev/null
+++ b/app/models/dmsf_link.rb
@@ -0,0 +1,100 @@
+# Redmine plugin for Document Management System "Features"
+#
+# Copyright (C) 2011-14 Karel Pičman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class DmsfLink < ActiveRecord::Base
+ unloadable
+
+ belongs_to :project
+ belongs_to :dmsf_folder
+ validates :name, :presence => true
+ validates :target_id, :presence => true
+ validates_length_of :name, :maximum => 255
+ scope :visible, where('NOT deleted')
+
+ def target_folder_id
+ if self.target_type == DmsfFolder.model_name
+ self.target_id
+ else
+ f = DmsfFile.find_by_id self.target_id
+ f.dmsf_folder_id if f
+ end
+ end
+
+ def target_folder
+ DmsfFolder.find_by_id self.target_folder_id if self.target_folder_id
+ end
+
+ def target_file_id
+ self.target_id if self.target_type == DmsfFile.model_name
+ end
+
+ def target_file
+ DmsfFile.find_by_id self.target_file_id if self.target_file_id
+ end
+
+ def target_project
+ Project.find_by_id self.target_project_id
+ end
+
+ def folder
+ DmsfFolder.find_by_id self.dmsf_folder_id
+ end
+
+ def title
+ self.name
+ end
+
+ def self.find_link_by_file_name(project, folder, filename)
+ links = DmsfLink.where(
+ :project_id => project.id,
+ :dmsf_folder_id => folder ? folder.id : nil,
+ :target_type => DmsfFile.model_name).visible.all
+ links.each do |link|
+ return link if link.target_file.name == filename
+ end
+ nil
+ end
+
+ def path
+ if self.target_type == DmsfFile.model_name
+ file = self.target_file
+ path = file.dmsf_path.map { |element| element.is_a?(DmsfFile) ? element.name : element.title }.join('/') if file
+ else
+ folder = self.target_folder
+ path = folder.dmsf_path_str if folder
+ end
+ path.insert(0, "#{self.target_project.name}:") if self.project_id != self.target_project_id && path
+ if path.length > 50
+ return "#{path[0, 25]}...#{path[-25, 25]}"
+ end
+ path
+ end
+
+ def copy_to(project, folder)
+ link = DmsfLink.new(
+ :target_project_id => self.target_project_id,
+ :target_id => self.target_id,
+ :target_type => self.target_type,
+ :name => self.name,
+ :project_id => project.id,
+ :dmsf_folder_id => folder ? folder.id : nil)
+ link.save
+ link
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb
index cba1d8cc..4a669856 100644
--- a/app/models/dmsf_mailer.rb
+++ b/app/models/dmsf_mailer.rb
@@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -19,72 +20,83 @@
require 'mailer'
class DmsfMailer < Mailer
+ layout 'mailer'
- def files_updated(user, files)
- project = files[0].project
- files = files.select { |file| file.notify? }
+ def files_updated(user, project, files)
+ if user && project && files.count > 0
+ files = files.select { |file| file.notify? }
+
+ redmine_headers 'Project' => project.identifier if project
+
+ @files = files
+ @project = project
+
+ set_language_if_valid user.language
+ mail :to => user.mail,
+ :subject => l(:text_email_doc_updated_subject, :project => project.name)
+ end
+ end
+
+ def files_deleted(user, project, files)
+ if user && files.count > 0
+ files = files.select { |file| file.notify? }
+
+ redmine_headers 'Project' => project.identifier if project
+
+ @files = files
+ @project = project
+
+ set_language_if_valid user.language
+ mail :to => user.mail,
+ :subject => l(:text_email_doc_deleted_subject, :project => project.name)
+ end
+ end
- redmine_headers "Project" => project.identifier
-
- @user = user
- @files = files
- @project = project
-
- mail :to => get_notify_user_emails(user, files),
- :subject => "#{project.name}: Dmsf files updated"
- end
-
- def files_deleted(user, files)
- project = files[0].project
- files = files.select { |file| file.notify? }
+ def send_documents(project, user, email_params)
+ zipped_content_data = open(email_params[:zipped_content], 'rb') { |io| io.read }
- redmine_headers 'Project' => project.identifier
+ redmine_headers 'Project' => project.identifier if project
- @user = user
- @files = files
- @project = project
-
- mail :to => get_notify_user_emails(user, files),
- :subject => "#{project.name}: Dmsf files deleted"
+ @body = email_params[:body]
+ @links_only = email_params[:links_only]
+ @folders = email_params[:folders]
+ @files = email_params[:files]
+
+ unless @links_only == '1'
+ attachments['Documents.zip'] = { :content_type => 'application/zip', :content => zipped_content_data }
+ end
+
+ mail :to => email_params[:to], :cc => email_params[:cc], :subject => email_params[:subject], :from => user.mail
end
- def send_documents(user, email_to, email_cc, email_subject, zipped_content, email_plain_body)
- zipped_content_data = open(zipped_content, 'rb') {|io| io.read }
-
- @body = email_plain_body
-
- attachments['Documents.zip'] = {:content_type => 'application/zip', :content => zipped_content_data}
- mail(:to => email_to, :cc => email_cc, :subject => email_subject, :from => user.mail)
- end
-
- def workflow_notification(user, workflow, revision, subject, text1, text2)
+ def workflow_notification(user, workflow, revision, subject_id, text1_id, text2_id, notice = nil)
if user && workflow && revision
- set_language_if_valid user.language
+ if revision.file && revision.file.project
+ @project = revision.file.project
+ redmine_headers 'Project' => @project.identifier
+ end
+ set_language_if_valid user.language
@user = user
@workflow = workflow
- @revision = revision
- @text1 = text1
- @text2 = text2
- mail :to => user.mail, :subject => subject
+ @revision = revision
+ @text1 = l(text1_id, :name => workflow.name, :filename => revision.file.name, :notice => notice)
+ @text2 = l(text2_id)
+ @notice = notice
+ mail :to => user.mail, :subject => l(subject_id, :name => workflow.name)
end
- end
-
- private
+ end
- def get_notify_user_emails(user, files)
- if files.empty?
- return []
- end
-
- project = files[0].project
-
+ def self.get_notify_users(user, files)
+ notify_files = files.select { |file| file.notify? }
+ return [] if notify_files.empty?
+ project = notify_files[0].project
notify_members = project.members
notify_members = notify_members.select do |notify_member|
- notify_user = notify_member.user
- if notify_user.pref[:no_self_notified] && notify_user == user
+ notify_user = notify_member.user
+ if notify_user == user && user.pref.no_self_notified
false
else
- if notify_member.dmsf_mail_notification.nil?
+ unless notify_member.dmsf_mail_notification
case notify_user.mail_notification
when 'all'
true
@@ -101,7 +113,7 @@ class DmsfMailer < Mailer
end
end
- notify_members.collect {|m| m.user.mail }
+ notify_members.collect { |m| m.user }
end
-end
+end
\ No newline at end of file
diff --git a/app/models/dmsf_upload.rb b/app/models/dmsf_upload.rb
index a5e3bc8a..5fb2161a 100644
--- a/app/models/dmsf_upload.rb
+++ b/app/models/dmsf_upload.rb
@@ -1,8 +1,8 @@
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
-# Copyright (C) 2013 Karel Pičman
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -38,12 +38,12 @@ class DmsfUpload
def self.create_from_uploaded_file(project, folder, uploaded_file)
uploaded = {
- 'disk_filename' => DmsfHelper.temp_filename(uploaded_file.original_filename),
- 'content_type' => uploaded_file.content_type.to_s,
- 'original_filename' => uploaded_file.original_filename,
+ :disk_filename => DmsfHelper.temp_filename(uploaded_file.original_filename),
+ :content_type => uploaded_file.content_type.to_s,
+ :original_filename => uploaded_file.original_filename,
}
- File.open("#{DmsfHelper.temp_dir}/#{uploaded["disk_filename"]}", "wb") do |f|
+ File.open("#{DmsfHelper.temp_dir}/#{uploaded[:disk_filename]}", 'wb') do |f|
while (buffer = uploaded_file.read(8192))
f.write(buffer)
end
@@ -52,15 +52,19 @@ class DmsfUpload
end
def initialize(project, folder, uploaded)
- @name = uploaded['original_filename']
+ @name = uploaded[:original_filename]
- dmsf_file = DmsfFile.visible.find_file_by_name(project, folder, @name)
+ file = DmsfFile.find_file_by_name(project, folder, @name)
+ unless file
+ link = DmsfLink.find_link_by_file_name(project, folder, @name)
+ file = link.target_file if link
+ end
- @disk_filename = uploaded['disk_filename']
- @mime_type = uploaded['content_type']
+ @disk_filename = uploaded[:disk_filename]
+ @mime_type = uploaded[:content_type]
@size = File.size(disk_file)
- if dmsf_file.nil? || dmsf_file.last_revision.nil?
+ if file.nil? || file.last_revision.nil?
@title = DmsfFileRevision.filename_to_title(@name)
@description = nil
@major_version = 0
@@ -68,24 +72,24 @@ class DmsfUpload
@workflow = nil
@custom_values = DmsfFileRevision.new(:file => DmsfFile.new(:project => @project)).custom_field_values
else
- last_revision = dmsf_file.last_revision
+ last_revision = file.last_revision
@title = last_revision.title
@description = last_revision.description
@major_version = last_revision.major_version
@minor_version = last_revision.minor_version
@workflow = last_revision.workflow
- @custom_values = Array.new(dmsf_file.last_revision.custom_values)
+ @custom_values = Array.new(file.last_revision.custom_values)
# Add default value for CFs not existing
- present_custom_fields = dmsf_file.last_revision.custom_values.collect(&:custom_field).uniq
- dmsf_file.last_revision.available_custom_fields.each do |cf|
+ present_custom_fields = file.last_revision.custom_values.collect(&:custom_field).uniq
+ file.last_revision.available_custom_fields.each do |cf|
unless present_custom_fields.include?(cf)
@custom_values << CustomValue.new({:custom_field => cf, :value => cf.default_value}) if cf.default_value
end
end
end
- @locked = dmsf_file && dmsf_file.locked_for_user?
+ @locked = file && file.locked_for_user?
end
-end
+end
\ No newline at end of file
diff --git a/app/models/dmsf_workflow.rb b/app/models/dmsf_workflow.rb
index 7478ae68..480e6b82 100644
--- a/app/models/dmsf_workflow.rb
+++ b/app/models/dmsf_workflow.rb
@@ -32,7 +32,7 @@ class DmsfWorkflow < ActiveRecord::Base
def participiants
users = Array.new
self.dmsf_workflow_steps.each do |step|
- users << step.user
+ users << step.user unless users.include? step.user
end
users
end
@@ -110,7 +110,7 @@ class DmsfWorkflow < ActiveRecord::Base
sql = '1=1'
end
- unless q.nil? || q.empty?
+ if q.present?
User.active.sorted.where(sql).like(q)
else
User.active.sorted.where(sql)
diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb
new file mode 100644
index 00000000..eda59eb0
--- /dev/null
+++ b/app/views/dmsf/_dir.html.erb
@@ -0,0 +1,108 @@
+<%#=
+# Redmine plugin for Document Management System "Features"
+#
+# Copyright (C) 2014 Karel Pičman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+%>
+
+<% locked_for_user = subfolder.locked_for_user? %>
+<% locked = subfolder.locked? %>
+
+<%= check_box_tag(name, id, false,
+ :title => l(:title_check_for_zip_download_or_email)) %>
+
+ <%= link_to(h(title),
+ dmsf_folder_path(:id => project, :folder_id => subfolder),
+ :class => 'icon icon-folder') %>
+ <% if link %>
+ <%= link.path %>
+ <% else %>
+ [<%= subfolder.files.visible.count + subfolder.file_links.visible.count %>]
+ <% end %>
+
+
+<%= format_time(subfolder.updated_at) %>
+ <% if locked_for_user %>
+ <% if subfolder.lock.reverse[0].user %>
+ <%= link_to('',
+ user_path(subfolder.lock.reverse[0].user),
+ :title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user),
+ :class => 'icon icon-dmsf-locked') %>
+ <% else %>
+ <%= content_tag(:span, '', :title => l(:notice_account_unknown_email),
+ :class => 'icon icon-dmsf-locked') %>
+ <% end %>
+ <% elsif locked %>
+ <%= content_tag(:span, '', :title => l(:title_locked_by_you),
+ :class => 'icon icon-dmsf-lockedbycurrent') %>
+ <% end %>
+
+
+
+<%= h(subfolder.user) %>
+
+ <% if @folder_manipulation_allowed %>
+
+ <% unless locked %>
+ <%= link_to('',
+ edit_dmsf_path(:id => project, :folder_id => subfolder),
+ :title => l(:link_edit, :title => h(subfolder.title)),
+ :class => 'icon icon-edit') %>
+ <%= link_to('',
+ lock_dmsf_path(:id => project, :folder_id => subfolder),
+ :title => l(:title_lock_file),
+ :class => 'icon icon-dmsf-lock') %>
+ <% if subfolder.notification %>
+ <%= link_to('',
+ notify_deactivate_dmsf_path(:id => project, :folder_id => subfolder),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to('',
+ notify_activate_dmsf_path(:id => project, :folder_id => subfolder),
+ :title => l(:title_notifications_not_active_activate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <% if link %>
+ <%= link_to('',
+ dmsf_link_path(link),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,
+ :title => l(:title_delete),
+ :class => 'icon icon-del') %>
+ <% else %>
+ <%= link_to('',
+ delete_dmsf_path(:id => project, :folder_id => @folder, :delete_folder_id => subfolder),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:title_delete),
+ :class => 'icon icon-del') %>
+ <% end %>
+ <% else %>
+
+ <% if (!locked_for_user || @force_file_unlock_allowed) && subfolder.unlockable? %>
+ <%= link_to('',
+ unlock_dmsf_path(:id => project, :folder_id => subfolder),
+ :title => l(:title_unlock_file),
+ :class => 'icon icon-dmsf-unlock')%>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+0
+0
+<%= subfolder.updated_at.to_i %>
+0
diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb
new file mode 100644
index 00000000..3c22b7c2
--- /dev/null
+++ b/app/views/dmsf/_file.html.erb
@@ -0,0 +1,183 @@
+<%#=
+# Redmine plugin for Document Management System "Features"
+#
+# Copyright (C) 2011-14 Karel Pičman
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+%>
+
+<% locked_for_user = file.locked_for_user? %>
+<% locked = file.locked? %>
+<% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %>
+
+<%= check_box_tag(name, id, false,
+ :title => l(:title_check_for_zip_download_or_email)) %>
+
+ <% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'show', :id => file, :download => ''}) %>
+ <%= link_to(h(title),
+ file_download_url,
+ :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}") %>
+ <%= h(link ? link.path : file.display_name) %>
+
+<%= number_to_human_size(file.last_revision.size) %>
+
+ <%= format_time(file.last_revision.updated_at) %>
+ <% if locked_for_user %>
+ <% if file.lock.reverse[0].user %>
+ <%= link_to('',
+ user_path(file.lock.reverse[0].user),
+ :title => l(:title_locked_by_user, :user => file.lock.reverse[0].user),
+ :class => 'icon icon-dmsf-locked') %>
+ <% else %>
+ <%= content_tag(:span, '',
+ :title => l(:notice_account_unknown_email),
+ :class => 'icon icon-dmsf-locked') %>
+ <% end %>
+ <% elsif locked %>
+ <%= content_tag(:span, '', :title => l(:title_locked_by_you),
+ :class => 'icon icon-dmsf-lockedbycurrent') %>
+ <% end %>
+
+<%= file.last_revision.version %>
+
+ <% if wf && @file_manipulation_allowed %>
+ <%= link_to(
+ file.last_revision.workflow_str(false),
+ log_dmsf_workflow_path(
+ :project_id => project.id,
+ :id => wf.id,
+ :dmsf_file_revision_id => file.last_revision.id),
+ :title => DmsfWorkflow.assignments_to_users_str(wf.next_assignments(file.last_revision.id)),
+ :remote => true) %>
+ <% else %>
+ <%= file.last_revision.workflow_str(false) %>
+ <% end %>
+
+<%= h(file.last_revision.user) %>
+
+ <% if @file_manipulation_allowed %>
+
+ <% unless locked %>
+ <%= link_to('',
+ dmsf_file_path(:id => file),
+ :title => l(:link_details, :title => h(file.last_revision.title)),
+ :class => 'icon icon-dmsf-file-details') %>
+ <%= link_to('',
+ lock_dmsf_files_path(:id => file),
+ :title => l(:title_lock_file),
+ :class => 'icon icon-dmsf-lock') %>
+ <% if file.notification %>
+ <%= link_to('',
+ notify_deactivate_dmsf_files_path(:id => file),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to('',
+ notify_activate_dmsf_files_path(:id => file),
+ :title => l(:title_notifications_not_active_activate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <% if link %>
+ <%= link_to('',
+ dmsf_link_path(link),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,
+ :title => l(:title_delete),
+ :class => 'icon icon-del') %>
+ <% else %>
+ <%= link_to('',
+ dmsf_file_path(:id => file),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,
+ :title => l(:title_delete),
+ :class => 'icon icon-del') unless locked_for_user %>
+ <% end %>
+ <% else %>
+
+ <% if (!locked_for_user || @force_file_unlock_allowed) && file.unlockable? %>
+ <%= link_to('',
+ unlock_dmsf_files_path(:id => file),
+ :title => l(:title_unlock_file),
+ :class => 'icon icon-dmsf-unlock')%>
+ <% else %>
+
+ <% end %>
+
+
+ <% end %>
+ <% case file.last_revision.workflow %>
+ <% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %>
+ <% if wf %>
+ <% assignments = wf.next_assignments(file.last_revision.id) %>
+ <% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %>
+ <% if index %>
+ <%= link_to('',
+ action_dmsf_workflow_path(
+ :project_id => project.id,
+ :id => wf.id,
+ :dmsf_workflow_step_assignment_id => assignments[index].id,
+ :dmsf_file_revision_id => file.last_revision.id),
+ :title => l(:title_waiting_for_approval),
+ :class => 'icon icon-dmsf-waiting-for-approval',
+ :remote => true) %>
+ <% else %>
+ <%= content_tag(:span, '',
+ :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}",
+ :class => 'icon icon-dmsf-waiting-for-approval') %>
+ <% end %>
+ <% else %>
+ <%= content_tag(:span, '',
+ :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}",
+ :class => 'icon icon-dmsf-waiting-for-approval') %>
+ <% end %>
+ <% when DmsfWorkflow::STATE_APPROVED %>
+ <%= content_tag(:span, '', :title => l(:title_approved),
+ :class => 'icon icon-dmsf-approved') %>
+ <% when DmsfWorkflow::STATE_ASSIGNED %>
+ <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
+ <%= link_to('',
+ start_dmsf_workflow_path(
+ :id => file.last_revision.dmsf_workflow_id,
+ :dmsf_file_revision_id => file.last_revision.id),
+ :title => l(:label_dmsf_wokflow_action_start),
+ :class => 'icon icon-dmsf-assigned') %>
+ <% else %>
+ <%= content_tag(:span, '',
+ title => l(:label_dmsf_wokflow_action_start),
+ :class => 'icon icon-dmsf-assigned') %>
+ <% end %>
+ <% when DmsfWorkflow::STATE_REJECTED %>
+ <%= content_tag(:span, '', :title => l(:title_rejected),
+ :class => 'icon icon-dmsf-rejected') %>
+ <% else %>
+ <% if @workflows_available %>
+ <%= link_to('',
+ assign_dmsf_workflow_path(
+ :project_id => project.id,
+ :dmsf_file_revision_id => file.last_revision.id),
+ :title => l(:label_dmsf_wokflow_action_assign),
+ :class => 'icon icon-dmsf-none',
+ :remote => true) %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+1
+<%= file.last_revision.size %>
+<%= file.last_revision.updated_at.to_i %>
+<%= file.last_revision.iversion %>
\ No newline at end of file
diff --git a/app/views/dmsf/_path.html.erb b/app/views/dmsf/_path.html.erb
index 2019d776..720314d4 100644
--- a/app/views/dmsf/_path.html.erb
+++ b/app/views/dmsf/_path.html.erb
@@ -18,17 +18,17 @@
<% if folder %>
- <%= link_to l(:link_documents), dmsf_path(:id => @project) %>
+ <%= link_to l(:link_documents), dmsf_folder_path(:id => @project) %>
<% folder.dmsf_path.each do |path_element| %>
/
<% if !filename && path_element == folder.dmsf_path.last %>
<%= h(path_element.title) %>
<% else %>
- <%= link_to h(path_element.title), dmsf_path(:id => @project, :folder_id => path_element) %>
+ <%= link_to h(path_element.title), dmsf_folder_path(:id => @project, :folder_id => path_element) %>
<% end %>
<% end %>
<% else %>
- <%= link_to l(:link_documents), dmsf_path(:id => @project) %>
+ <%= link_to l(:link_documents), dmsf_folder_path(:id => @project) %>
<% end %>
<% if filename %>
/
diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb
index 6e537eb5..ce151d15 100644
--- a/app/views/dmsf/edit.html.erb
+++ b/app/views/dmsf/edit.html.erb
@@ -20,9 +20,43 @@
<% html_title(l(:dmsf)) %>
- <%= link_to(image_tag('copy.png'),
- {:controller => :dmsf_folders_copy, :action => 'new', :id => @folder },
- :title => l(:title_copy)) if @folder.id %>
+ <% if User.current.allowed_to?(:folder_manipulation, @project) && params[:action] == 'edit' %>
+ <% unless @folder.locked? %>
+ <%= link_to(l(:button_lock),
+ lock_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_lock_file),
+ :class => 'icon icon-dmsf-lock') %>
+ <% if @folder.notification %>
+ <%= link_to(l(:label_notifications_off),
+ notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to(l(:label_notifications_on),
+ notify_activate_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_notifications_not_active_activate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <%= link_to(l(:label_link_to),
+ new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder.id, :type => 'link_to'),
+ :title => l(:title_create_link),
+ :class => 'icon icon-link') %>
+ <%= link_to(l(:button_copy), copy_folder_path(:id => @folder),
+ :title => l(:title_copy), :class => 'icon icon-copy') %>
+ <%= link_to(l(:button_delete),
+ delete_dmsf_path(:id => @project, :folder_id => @folder.dmsf_folder_id, :delete_folder_id => @folder),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:title_delete),
+ :class => 'icon icon-del') %>
+ <% else %>
+ <% if (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) && @folder.unlockable? %>
+ <%= link_to(l(:button_unlock),
+ unlock_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_unlock_file),
+ :class => 'icon icon-dmsf-unlock')%>
+ <% end %>
+ <% end %>
+ <% end %>
<% create = @pathfolder == @parent %>
@@ -64,7 +98,3 @@
<% end %>
<%= wikitoolbar_for 'dmsf_folder_description' %>
-
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
-<% end %>
diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb
index a665999b..c16163be 100644
--- a/app/views/dmsf/edit_root.html.erb
+++ b/app/views/dmsf/edit_root.html.erb
@@ -20,11 +20,22 @@
<% html_title(l(:dmsf)) %>
+ <% if User.current.allowed_to?(:folder_manipulation, @project) %>
+ <% if @project.dmsf_notification %>
+ <%= link_to(l(:label_notifications_off),
+ notify_deactivate_dmsf_path(:id => @project),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to(l(:label_notifications_on),
+ notify_activate_dmsf_path(:id => @project),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <% end %>
-
- <%= link_to l(:link_documents), {:controller => 'dmsf', :action => 'show', :id => @project } %>
-
+<%= render(:partial => 'path', :locals => {:folder => nil, :filename => nil}) %>
<%= form_for(@project, :url => {:action => 'save_root', :id => @project},
:html => {:method=>:post}) do |f| %>
@@ -39,8 +50,4 @@
<%= submit_tag(l(:submit_save)) %>
<% end %>
-<%= wikitoolbar_for 'dmsf_folder_description' %>
-
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
-<% end %>
+<%= wikitoolbar_for 'project_dmsf_description' %>
\ No newline at end of file
diff --git a/app/views/dmsf/email_entries.html.erb b/app/views/dmsf/email_entries.html.erb
index 522f2c13..a4b180e0 100644
--- a/app/views/dmsf/email_entries.html.erb
+++ b/app/views/dmsf/email_entries.html.erb
@@ -1,7 +1,8 @@
<%# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -28,10 +29,13 @@
<%= form_tag({:action => 'entries_email', :id => @project, :folder_id => @folder},
{ :method=>:post, :class => 'tabular'}) do %>
+ <%= hidden_field_tag('email[zipped_content]', @email_params[:zipped_content]) %>
+ <%= hidden_field_tag('email[folders]', @email_params[:folders].to_json) %>
+ <%= hidden_field_tag('email[files]', @email_params[:files].to_json) %>
<%= label_tag('', "#{l(:label_email_from)}:") %>
- <%= h(User.current.mail) %>
+ <%= h(Setting.mail_from) %>
<%= label_tag('email[to]', "#{l(:label_email_to)}:") %>
@@ -47,8 +51,8 @@
<%= label_tag('', "#{l(:label_email_documents)}:") %>
- Documents.zip
- <%= hidden_field_tag('email[zipped_content]', @email_params['zipped_content']) %>
+ <%= link_to 'Documents.zip', download_email_entries_path(:id => @project, :folder_id => @folder, :path => @email_params[:zipped_content]) %>
+ <%= l(:label_or) %> <%= check_box_tag('email[links_only]') %> <%= l(:label_links_only) %>
<%= label_tag('email[body]', "#{l(:label_email_body)}:") %>
@@ -57,3 +61,5 @@
<%= submit_tag(l(:label_email_send)) %>
<% end %>
+
+<%= wikitoolbar_for 'email_body' %>
diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb
index d18d9a9c..965b6fc6 100644
--- a/app/views/dmsf/show.html.erb
+++ b/app/views/dmsf/show.html.erb
@@ -1,9 +1,9 @@
<%#=
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
-# Copyright (C) 2013 Karel Pičman
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -22,47 +22,73 @@
<% html_title(l(:dmsf)) %>
- <% if User.current.allowed_to?(:folder_manipulation, @project) %>
- <% if @folder.nil? %>
-
- <%= link_to('', {:action => 'edit_root', :id => @project},
- :title => l(:link_edit, :title => l(:link_documents)), :class => 'icon icon-edit') %>
- <% elsif @locked_for_user %>
-
- <%= link_to('', {:action => 'edit', :id => @project, :folder_id => @folder },
- :title => l(:link_edit, :title => h(@folder.title)), :class => 'icon icon-edit') %>
+ <% if @folder_manipulation_allowed %>
+ <% if @folder.nil? %>
+ <%= link_to(l(:button_edit),
+ edit_root_dmsf_path(:id => @project),
+ :title => l(:link_edit, :title => l(:link_documents)),
+ :class => 'icon icon-edit') %>
+ <% elsif !@locked_for_user %>
+ <%= link_to(l(:button_edit),
+ edit_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:link_edit, :title => h(@folder.title)),
+ :class => 'icon icon-edit') %>
<% end %>
<% if @folder && (!@locked_for_user || User.current.allowed_to?(:force_file_unlock, @project)) %>
<% if @folder.locked? %>
<% unless @folder.unlockable? %>
- <%= image_tag('locked.png', :plugin => :redmine_dmsf, :title => l(:title_folder_parent_locked, :name => @folder.folder.lock.reverse[0].folder.title)) unless @folder.nil?%>
+ <%= link_to(l(:button_unlock),
+ :title => l(:title_folder_parent_locked, :name => @folder.folder.lock.reverse[0].folder.title),
+ :class => 'icon icon-dmsf-unlock') if @folder %>
<% else %>
- <%= link_to_function(image_tag('unlock.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'unlock', :id => @project, :folder_id => @folder, :current => request.url)}')",
- :title => l(:title_unlock_folder)) if @folder %>
+ <%= link_to(l(:button_unlock),
+ unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
+ :title => l(:title_unlock_folder),
+ :class => 'icon icon-dmsf-unlock') if @folder %>
<% end %>
<% else %>
- <%= link_to_function(image_tag('lock.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'lock', :id => @project, :folder_id => @folder, :current => request.url)}')",
- :title => l(:title_lock_folder)) if @folder %>
+ <%= link_to(l(:button_lock),
+ lock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
+ :title => l(:title_lock_folder),
+ :class => 'icon icon-dmsf-lock') if @folder %>
<% end %>
<% end %>
- <% unless @folder %>
-
- <% if @project.dmsf_notification %>
- <%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project)}')",
- :title => l(:title_notifications_active_deactivate)) %>
- <% else %>
- <%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:action => 'notify_activate', :id => @project)}')",
- :title => l(:title_notifications_not_active_activate)) %>
- <% end %>
- <% end %>
-
- <%= link_to('', {:action => 'new', :id => @project, :parent_id => @folder },
- :title => l(:link_create_folder), :class => 'icon icon-add') unless @locked_for_user %>
- <% end %>
+ <% unless @folder %>
+ <% if @project.dmsf_notification %>
+ <%= link_to(l(:label_notifications_off),
+ notify_deactivate_dmsf_path(:id => @project),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to(l(:label_notifications_on),
+ notify_activate_dmsf_path(:id => @project),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <% else %>
+ <% if @folder.notification %>
+ <%= link_to(l(:label_notifications_off),
+ notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to(l(:label_notifications_on),
+ notify_activate_dmsf_path(:id => @project, :folder_id => @folder),
+ :title => l(:title_notifications_not_active_activate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <% end %>
+ <% if @file_manipulation_allowed %>
+ <%= link_to(l(:label_link_from),
+ new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder, :type => 'link_from'),
+ :title => l(:title_create_link),
+ :class => 'icon icon-link') unless @locked_for_user %>
+ <% end %>
+ <%= link_to(l(:link_create_folder),
+ new_dmsf_path(:id => @project, :parent_id => @folder),
+ :title => l(:link_create_folder),
+ :class => 'icon icon-add') unless @locked_for_user %>
+ <% end %>
<%= render(:partial => 'path', :locals => {:folder => @folder, :filename => nil}) %>
@@ -81,10 +107,18 @@
<%= submit_tag(l(:submit_download), :title => l(:title_download_checked), :name => 'download_entries') %>
<%= submit_tag(l(:submit_email), :title => l(:title_send_checked_by_email), :name => 'email_entries') %>
- <% if User.current.allowed_to?(:file_manipulation, @project) && @folder && !@locked_for_user %>
+ <% if @file_manipulation_allowed && @folder_manipulation_allowed && !@locked_for_user %>
<%= l(:button_delete) %>
- <% end %>
+ <% end %>
+ <% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>
+ <% unless values.empty? %>
+
+ <%= custom_field_tag_with_label(
+ :dmsf_folder,
+ CustomValue.new(:custom_field_id => params[:custom_field_id].present? ? params[:custom_field_id] : values.first.custom_field_id, :value => params[:custom_value])) %>
+
+ <% end %>
@@ -100,250 +134,84 @@
+
+
-
- <% @subfolders.each do |subfolder| %>
- <% locked_for_user = subfolder.locked_for_user? %>
- <% locked = subfolder.locked? %>
+
+ <% @subfolders.each do |subfolder| %>
- <%= check_box_tag('subfolders[]', subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %>
-
- <%= link_to(h(subfolder.title),
- {:action => 'show', :id => @project, :folder_id => subfolder}, :class => 'icon icon-folder') %>
- [<%= subfolder.files.visible.count %>]
-
-
- <%= format_time(subfolder.updated_at) %>
- <% if locked_for_user %>
- <% if subfolder.lock.reverse[0].user %>
- <%= link_to(image_tag('locked.png', :plugin => :redmine_dmsf),
- { :controller => 'users', :action => 'show', :id => subfolder.lock.reverse[0].user },
- :title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user.to_s)) %>
- <% else %>
- <%= image_tag('locked.png', :title => l(:notice_account_unknown_email), :plugin => :redmine_dmsf) %>
- <% end %>
- <% elsif locked %>
- <%= image_tag('lockedbycurrent.png', :title => l(:title_locked_by_you), :plugin => :redmine_dmsf) %>
- <% end %>
-
-
-
- <%= h(subfolder.user) %>
-
- <% if @folder_manipulation_allowed %>
-
- <% if subfolder.notification %>
- <%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
- :title => l(:title_notifications_active_deactivate)) %>
- <% else %>
- <%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
- :title => l(:title_notifications_not_active_activate)) %>
- <% end %>
-
-
-
- <%= link_to(image_tag('edit.png', :class =>'detail_icon'),
- {:action => 'edit', :id => @project, :folder_id => subfolder },
- :title => l(:link_edit, :title => h(subfolder.title))) unless locked_for_user %>
-
-
- <% unless locked_for_user && !User.current.allowed_to?(:force_file_unlock, @project)%>
- <% if locked %>
- <% if subfolder.unlockable? %>
- <%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf', :action => 'unlock',
- :id => @project, :folder_id => subfolder)}')",
- :title => l(:title_unlock_file))%>
- <% else %>
- <%= image_tag('locked.png', :plugin => :redmine_dmsf,
- :title => l(:title_folder_parent_locked, :name => subfolder.lock.reverse[0].folder.title)) %>
- <% end %>
- <% else %>
- <%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf', :action => 'lock',
- :id => @project, :folder_id => subfolder)}')",
- :title => l(:title_lock_file)) %>
- <% end %>
-
- <% end %>
- <%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
- "confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
- :title => l(:title_delete)) unless locked_for_user %>
-
-
-
- <% end %>
-
- 0
- 0
+ <%= render(:partial => 'dir',
+ :locals => {
+ :project => @project,
+ :subfolder => subfolder,
+ :link => nil,
+ :id => subfolder.id,
+ :name => 'subfolders[]',
+ :title => subfolder.title }) %>
<% end %>
- <% workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0 %>
+ <% @dir_links.each do |link| %>
+
+ <%= render(:partial => 'dir',
+ :locals => {
+ :project => link.target_project,
+ :subfolder => link.target_folder,
+ :link => link,
+ :id => link.id,
+ :name => 'dir_links[]',
+ :title => link.name }) %>
+
+ <% end %>
<% @files.each do |file| %>
<% unless file.last_revision %>
<% Rails.logger.error "Error: dmsf_file id #{file.id} has no revision!" %>
<% next %>
- <% end %>
- <% locked_for_user = file.locked_for_user? %>
- <% locked = file.locked? %>
- <% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %>
+ <% end %>
- <%= check_box_tag('files[]', file.id, false, :title => l(:title_check_for_zip_download_or_email)) %>
-
- <% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'show', :id => file, :download => ''}) %>
- <%= link_to(h(file.last_revision.display_title),
- file_download_url,
- :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}") %>
- <%= h(file.display_name) %>
-
- <%= number_to_human_size(file.last_revision.size) %>
-
- <%= format_time(file.last_revision.updated_at) %>
- <% if locked_for_user %>
- <% if file.lock.reverse[0].user %>
- <%= link_to(image_tag('locked.png', :plugin => :redmine_dmsf),
- {:controller => 'users', :action => 'show', :id => file.lock.reverse[0].user },
- :title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
- <% else %>
- <%= image_tag('locked.png', :title => l(:notice_account_unknown_email), :plugin => :redmine_dmsf) %>
- <% end %>
- <% elsif locked %>
- <%= image_tag('lockedbycurrent.png', :title => l(:title_locked_by_you), :plugin => :redmine_dmsf) %>
- <% end %>
-
- <%= file.last_revision.version %>
-
- <% if wf && @file_manipulation_allowed %>
- <%= link_to(
- file.last_revision.workflow_str(false),
- log_dmsf_workflow_path(
- :project_id => @project.id,
- :id => wf.id,
- :dmsf_file_revision_id => file.last_revision.id),
- :title => DmsfWorkflow.assignments_to_users_str(wf.next_assignments(file.last_revision.id)),
- :remote => true) %>
- <% else %>
- <%= file.last_revision.workflow_str(false) %>
- <% end %>
-
- <%= h(file.last_revision.user) %>
-
- <% if @file_manipulation_allowed %>
-
- <% if file.notification %>
- <%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_deactivate', :id => file)}')",
- :title => l(:title_notifications_active_deactivate)) %>
- <% else %>
- <%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_activate', :id => file)}')",
- :title => l(:title_notifications_not_active_activate)) %>
- <% end %>
- <% case file.last_revision.workflow %>
- <% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %>
- <% if wf %>
- <% assignments = wf.next_assignments(file.last_revision.id) %>
- <% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %>
- <% if index %>
- <%= link_to(
- image_tag('waiting_for_approval.png', :plugin => :redmine_dmsf),
- action_dmsf_workflow_path(
- :project_id => @project.id,
- :id => wf.id,
- :dmsf_workflow_step_assignment_id => assignments[index].id,
- :dmsf_file_revision_id => file.last_revision.id),
- :title => l(:title_waiting_for_approval),
- :remote => true) %>
- <% else %>
- <%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
- <% end %>
- <% else %>
- <%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
- <% end %>
- <% when DmsfWorkflow::STATE_APPROVED %>
- <%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
- <% when DmsfWorkflow::STATE_ASSIGNED %>
- <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
- <%= link_to_function(image_tag('assigned.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{start_dmsf_workflow_path(
- :id => file.last_revision.dmsf_workflow_id,
- :dmsf_file_revision_id => file.last_revision.id)}')",
- :title => l(:label_dmsf_wokflow_action_start)) %>
- <% else %>
- <%= image_tag('assigned.png', :title => l(:label_dmsf_wokflow_action_start), :plugin => :redmine_dmsf) %>
- <% end %>
- <% when DmsfWorkflow::STATE_REJECTED %>
- <%= image_tag('rejected.png', :title => l(:title_rejected), :plugin => :redmine_dmsf) %>
- <% else %>
- <% if workflows_available %>
- <%= link_to(
- image_tag('none.png', :plugin => :redmine_dmsf),
- assign_dmsf_workflow_path(
- :project_id => @project.id,
- :dmsf_file_revision_id => file.last_revision.id),
- :title => l(:label_dmsf_wokflow_action_assign),
- :remote => true) %>
- <% end %>
- <% end %>
-
-
-
- <%= link_to(image_tag('filedetails.png', :plugin => :redmine_dmsf, :class =>'detail_icon'),
- {:controller => 'dmsf_files', :action => :show, :id => file },
- :title => l(:link_details, :title =>h(file.last_revision.title))) %>
-
-
- <% if !locked_for_user || @force_file_unlock_allowed %>
- <% if locked %>
- <% if file.unlockable? %>
- <%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'unlock', :id => file)}')",
- :title => l(:title_unlock_file))%>
- <% else %>
- <%= image_tag('locked.png', :plugin => :redmine_dmsf,
- :title => l(:title_file_parent_locked, :name => file.folder.lock.reverse[0].folder.title)) %>
- <% end%>
- <% else %>
- <%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
- "manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'lock', :id => file)}')",
- :title => l(:title_lock_file)) %>
- <% end %>
-
- <% end %>
- <% unless locked_for_user %>
- <%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
- "confirmation_link('#{url_for(:controller => 'dmsf_files', :action => 'delete', :id => file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
- :title => l(:title_delete)) %>
- <% end %>
-
-
-
- <% end %>
-
- 1
- <%= file.last_revision.size %>
+ <%= render(:partial => 'file', :locals => {
+ :project => @project,
+ :file => file,
+ :link => nil,
+ :id => file.id,
+ :name => 'files[]',
+ :title => file.title }) %>
+
+ <% end %>
+ <% @file_links.each do |link| %>
+ <% unless link.target_file.last_revision %>
+ <% Rails.logger.error "Error: dmsf_file id #{link.target_id} has no revision!" %>
+ <% next %>
+ <% end %>
+
+ <%= render(:partial => 'file', :locals => {
+ :project => link.target_project,
+ :file => link.target_file,
+ :link => link,
+ :id => link.id,
+ :name => 'file_links[]',
+ :title => link.name }) %>
<% end %>
-
-
+
<% end %>
@@ -355,19 +223,16 @@
end
%>
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag 'jquery-ui/jquery-ui-1.9.2.css', :plugin => 'redmine_dmsf' %>
+<% content_for :header_tags do %>
<%= stylesheet_link_tag 'plupload/jquery.ui.plupload.css', :plugin => 'redmine_dmsf' %>
<%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %>
- <%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
-
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery-ui-1.8.13.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
-
<% end %>
-<%= render(:partial => 'multi_upload') if (@file_manipulation_allowed && !@locked_for_user) %>
-
+<%= render(:partial => 'multi_upload') if (@file_manipulation_allowed && !@locked_for_user) %>
\ No newline at end of file
diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb
index 9398d29e..3db76d92 100644
--- a/app/views/dmsf_files/_file_new_revision.html.erb
+++ b/app/views/dmsf_files/_file_new_revision.html.erb
@@ -26,13 +26,13 @@
<% if @file.locked_for_user? %>
<%= l(:info_file_locked) %>
<% else %>
- <%= form_for(@revision, :url => {:action => 'create_revision', :id => @file},
- :html => {:method=>:post, :multipart => true, :id => 'new_revision_form'}) do |f| %>
+ <%= form_for(@revision, :url => { :action => 'create_revision', :id => @file },
+ :html => { :method => :post, :multipart => true, :id => 'new_revision_form' }) do |f| %>
<%= label_tag('dmsf_file_revision_title', "#{l(:label_title)}:") %>
- <%= f.text_field(:title, :size => '32') %>
+ <%= f.text_field(:title, :size => 32) %>
@@ -41,7 +41,7 @@
<%= f.select(:dmsf_folder_id,
options_for_select(DmsfFolder.directory_tree(@project),
:selected => (@revision.folder.id if @revision.folder))) %> /
- <%= f.text_field(:name, :size => '22') %>
+ <%= f.text_field(:name, :size => 22) %>
@@ -49,7 +49,7 @@
<%= label_tag('dmsf_file_revision_description', "#{l(:label_description)}:") %>
- <%= f.text_area(:description, :rows=> '6', :class => 'wiki-edit') %>
+ <%= f.text_area(:description, :rows => 6, :class => 'wiki-edit') %>
@@ -69,14 +69,14 @@
<%= label_tag('file_upload', "#{l(:label_new_content)}:") %>
-
- <%= file_field_tag('file_upload', :size => 30) %>
-
-
- (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
-
-
-
+
+
+ <%= file_field_tag('file_upload') %>
+
+
+ (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
+
+
@@ -87,12 +87,12 @@
-
+
<%= submit_tag(l(:submit_create)) %>
<% end %>
<% end %>
diff --git a/app/views/dmsf_files/_revision_access.html.erb b/app/views/dmsf_files/_revision_access.html.erb
index b7629009..a13a736c 100644
--- a/app/views/dmsf_files/_revision_access.html.erb
+++ b/app/views/dmsf_files/_revision_access.html.erb
@@ -19,25 +19,24 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
-
-
-
+
+
+
+
+ <%= l(:field_user) %>
+ <%= l(:heading_access_downloads_emails) %>
+ <%= l(:heading_access_first) %>
+ <%= l(:heading_access_last) %>
+
+
+
+ <% revision.access_grouped.each do |access| %>
- <%= l(:field_user) %>
- <%= l(:heading_access_downloads_emails) %>
- <%= l(:heading_access_first) %>
- <%= l(:heading_access_last) %>
+ <%= link_to_user(access.user) %>
+ <%= access['count'] %>
+ <%= format_time(DmsfHelper::to_time(access.first_at)) %>
+ <%= format_time(DmsfHelper::to_time(access.last_at)) %>
-
-
- <% revision.access_grouped.each do |access| %>
-
- <%= link_to_user(access.user) %>
- <%= access['count'] %>
- <%= format_time(DmsfHelper::to_time(access.first_at)) %>
- <%= format_time(DmsfHelper::to_time(access.last_at)) %>
-
- <% end %>
-
-
-
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb
index 4b73d305..c58d28b5 100644
--- a/app/views/dmsf_files/show.html.erb
+++ b/app/views/dmsf_files/show.html.erb
@@ -1,9 +1,9 @@
<%#=
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
-# Copyright (C) 2013 Karel Pičman
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -24,40 +24,38 @@
<% if User.current.allowed_to?(:file_manipulation, @project) %>
- <% unless @file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
- <% if @file.locked? %>
- <% unless @file.unlockable? %>
- <%= image_tag('locked.png', :plugin => :redmine_dmsf, :title => l(:title_file_parent_locked, :name => @file.lock.reverse[0].folder.title)) %>
- <% else %>
- <%= link_to_function(image_tag('unlock.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'unlock', :id => @file, :current => request.url)}')",
- :title => l(:title_unlock_file)) %>
- <% end %>
- <% else %>
- <%= link_to_function(image_tag('lock.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'lock', :id => @file, :current => request.url)}')",
- :title => l(:title_lock_file)) %>
- <% end %>
- <% end %>
- <% unless @file.locked_for_user? %>
-
- <%= link_to_function(image_tag('delete.png', :plugin => 'redmine_dmsf'),
- "confirmation_link('#{url_for(:action => 'delete', :id => @file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
- :title => l(:title_delete)) %>
- <% end %>
-
- <% if @file.notification %>
- <%= link_to_function(image_tag('notify.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @file, :current => request.url)}')",
- :title => l(:title_notifications_active_deactivate)) %>
+ <% unless @file.locked? %>
+ <%= link_to(l(:button_lock),
+ lock_dmsf_files_path(:id => @file),
+ :title => l(:title_lock_file),
+ :class => 'icon icon-dmsf-lock') %>
+ <% if @file.notification %>
+ <%= link_to(l(:label_notifications_off),
+ notify_deactivate_dmsf_files_path(:id => @file),
+ :title => l(:title_notifications_active_deactivate),
+ :class => 'icon icon-notification-on') %>
+ <% else %>
+ <%= link_to(l(:label_notifications_on),
+ notify_activate_dmsf_files_path(:id => @file),
+ :title => l(:title_notifications_not_active_activate),
+ :class => 'icon icon-notification-off') %>
+ <% end %>
+ <%= link_to(l(:label_link_to),
+ new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @file.folder ? @file.folder.id : nil, :dmsf_file_id => @file.id, :type => 'link_to'),
+ :title => l(:title_create_link),
+ :class => 'icon icon-link') %>
+ <%= link_to("#{l(:button_copy)}/#{l(:button_move)}", copy_file_path(:id => @file),
+ :title => l(:title_copy), :class => 'icon icon-copy') %>
+ <%= delete_link @file %>
<% else %>
- <%= link_to_function(image_tag('notifynot.png', :plugin => 'redmine_dmsf'),
- "manipulation_link('#{url_for(:action => 'notify_activate', :id => @file, :current => request.url)}')",
- :title => l(:title_notifications_not_active_activate)) %>
- <% end %>
-
- <%= link_to(image_tag('copy.png'), {:controller => :dmsf_files_copy, :action => 'new', :id => @file }, :title => l(:title_copy_or_move)) %>
- <% end %>
+ <% if (!@file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) && @file.unlockable? %>
+ <%= link_to(l(:button_unlock),
+ unlock_dmsf_files_path(:id => @file),
+ :title => l(:title_unlock_file),
+ :class => 'icon icon-dmsf-unlock')%>
+ <% end %>
+ <% end %>
+ <% end %>
<%= render(:partial => '/dmsf/path', :locals => {:folder => @file.folder, :filename => @file.title}) %>
@@ -65,22 +63,28 @@
<%= error_messages_for('file') %>
<%= error_messages_for('revision') %>
<%= render(:partial => 'file_new_revision') if User.current.allowed_to?(:file_manipulation, @file.project) %>
-<%= form_tag('', :id => 'entries_form') %>
<%= l(:heading_revisions) %>
<% @file.revisions.visible[@revision_pages.offset,@revision_pages.per_page].each do |revision| %>
\ No newline at end of file
diff --git a/app/views/dmsf_upload/_upload_file.html.erb b/app/views/dmsf_upload/_upload_file.html.erb
index 8176802b..a552bb44 100644
--- a/app/views/dmsf_upload/_upload_file.html.erb
+++ b/app/views/dmsf_upload/_upload_file.html.erb
@@ -1,9 +1,9 @@
<%#=
# Redmine plugin for Document Management System "Features"
#
-# Copyright (C) 2011 Vít Jonáš
-# Copyright (C) 2012 Daniel Munn
-# Copyright (C) 2013 Karel Pičman
+# Copyright (C) 2011 Vít Jonáš
+# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2011-14 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -25,7 +25,7 @@
<%= label_tag("commited_files[#{i}][title]", "#{l(:label_title)}:") %>
- <%= text_field_tag("commited_files[#{i}][title]", upload.title, :size => '32') %>
+ <%= text_field_tag("commited_files[#{i}][title]", upload.title, :size => 32) %>
@@ -40,7 +40,7 @@
<%= label_tag("commited_files[#{i}][description]", "#{l(:label_description)}:") %>
- <%= text_area_tag("commited_files[#{i}][description]", upload.description, :rows=> '6', :class => 'wiki-edit') %>
+ <%= text_area_tag("commited_files[#{i}][description]", upload.description, :rows=> 6, :class => 'wiki-edit') %>
@@ -69,10 +69,10 @@
<% end %>
<%= label_tag("commited_files[#{i}][comment]", "#{l(:label_comment)}:") %>
-
- <%= text_area_tag("commited_files[#{i}][comment]", upload.comment, :rows=> '2', :style => 'width: 99%;') %>
-
+
+ <%= text_area_tag("commited_files[#{i}][comment]", upload.comment, :rows => 2, :style => 'width: 99%;') %>
+
<%= wikitoolbar_for "commited_files_#{i}_description" %>
diff --git a/app/views/dmsf_upload/upload_file.html.erb b/app/views/dmsf_upload/upload_file.html.erb
index e239ebea..a538310c 100644
--- a/app/views/dmsf_upload/upload_file.html.erb
+++ b/app/views/dmsf_upload/upload_file.html.erb
@@ -2,6 +2,7 @@
#
# Copyright (C) 2011 Vít Jonáš
# Copyright (C) 2012 Daniel Munn
+# Copyright (C) 2014 Karel Pičman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -17,5 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
-{"original_filename":"<%= h(@tempfile.original_filename) %>", "content_type":"<%= h(@tempfile.content_type) %>",
-"disk_filename":"<%= h(@disk_filename) %>"}
\ No newline at end of file
+{"original_filename":"<%= (@tempfile.original_filename).html_safe %>",
+ "content_type":"<%= (@tempfile.content_type).html_safe %>",
+ "disk_filename":"<%= (@disk_filename).html_safe %>"}
\ No newline at end of file
diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb
index 9513c916..ff2637d8 100644
--- a/app/views/dmsf_upload/upload_files.html.erb
+++ b/app/views/dmsf_upload/upload_files.html.erb
@@ -41,14 +41,4 @@
<% i += 1 %>
<% end %>
<%= submit_tag(l(:submit_commit)) %>
-<% end %>
-
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
- <%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
-
-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/dmsf_workflows/_action.html.erb b/app/views/dmsf_workflows/_action.html.erb
index 7b8ef077..3774cd58 100644
--- a/app/views/dmsf_workflows/_action.html.erb
+++ b/app/views/dmsf_workflows/_action.html.erb
@@ -34,8 +34,8 @@
<%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %>
<%= text_field_tag 'user_search', nil %>
- <%= javascript_tag "observeSearchfield('user_search', 'users_for_delegate', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@workflow, :dmsf_workflow_step_assignment_id => params[:dmsf_workflow_step_assignment_id], :dmsf_file_revision_id => params[:dmsf_file_revision_id]) }')" %>
- <%= content_tag('div', principals_radio_button_tags('step_action', @workflow.delegates(nil, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id])), :id => 'users_for_delegate') %>
+ <%= javascript_tag "observeSearchfield('user_search', 'users_for_delegate', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, :dmsf_workflow_step_assignment_id => params[:dmsf_workflow_step_assignment_id], :dmsf_file_revision_id => params[:dmsf_file_revision_id]) }')" %>
+ <%= content_tag('div', principals_radio_button_tags('step_action', @dmsf_workflow.delegates(nil, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id])), :id => 'users_for_delegate') %>
diff --git a/app/views/dmsf_workflows/_log.html.erb b/app/views/dmsf_workflows/_log.html.erb
index aff97ed5..83c2ac5f 100644
--- a/app/views/dmsf_workflows/_log.html.erb
+++ b/app/views/dmsf_workflows/_log.html.erb
@@ -24,10 +24,10 @@
<%= label_tag('dmsf_file_revision_comment', "#{l(:label_comment)}:") %> -