#499, #555 optionable DMSF columns

This commit is contained in:
Karel Picman 2017-01-10 10:01:33 +01:00
parent e33010471f
commit a1a4dc8a67
28 changed files with 669 additions and 225 deletions

View File

@ -51,7 +51,7 @@ class DmsfFile < ActiveRecord::Base
scope :deleted, -> { where(:deleted => STATUS_DELETED) } scope :deleted, -> { where(:deleted => STATUS_DELETED) }
validates :name, :presence => true validates :name, :presence => true
validates_format_of :name, :with => DmsfFolder.invalid_characters, validates_format_of :name, :with => DmsfFolder::INVALID_CHARACTERS,
:message => l(:error_contains_invalid_character) :message => l(:error_contains_invalid_character)
validate :validates_name_uniqueness validate :validates_name_uniqueness
@ -470,4 +470,11 @@ class DmsfFile < ActiveRecord::Base
false false
end end
def custom_value(custom_field)
self.last_revision.custom_field_values.each do |cv|
return cv.value if cv.custom_field == custom_field
end
nil
end
end end

View File

@ -55,7 +55,7 @@ class DmsfFileRevision < ActiveRecord::Base
where("#{DmsfFile.table_name}.deleted = ?", STATUS_ACTIVE) where("#{DmsfFile.table_name}.deleted = ?", STATUS_ACTIVE)
validates :title, :presence => true validates :title, :presence => true
validates_format_of :name, :with => DmsfFolder.invalid_characters, validates_format_of :name, :with => DmsfFolder::INVALID_CHARACTERS,
:message => l(:error_contains_invalid_character) :message => l(:error_contains_invalid_character)
def project def project

View File

@ -3,7 +3,7 @@
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@konton.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@konton.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -24,9 +24,6 @@ class DmsfFolder < ActiveRecord::Base
include RedmineDmsf::Lockable include RedmineDmsf::Lockable
cattr_reader :invalid_characters
@@invalid_characters = /\A[^\/\\\?":<>]*\z/
belongs_to :project belongs_to :project
belongs_to :dmsf_folder belongs_to :dmsf_folder
belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id' belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
@ -46,8 +43,11 @@ class DmsfFolder < ActiveRecord::Base
has_many :locks, -> { where(entity_type: 1).order("#{DmsfLock.table_name}.updated_at DESC") }, has_many :locks, -> { where(entity_type: 1).order("#{DmsfLock.table_name}.updated_at DESC") },
:class_name => 'DmsfLock', :foreign_key => 'entity_id', :dependent => :destroy :class_name => 'DmsfLock', :foreign_key => 'entity_id', :dependent => :destroy
STATUS_DELETED = 1 INVALID_CHARACTERS = /\A[^\/\\\?":<>]*\z/.freeze
STATUS_ACTIVE = 0 STATUS_DELETED = 1.freeze
STATUS_ACTIVE = 0.freeze
AVAILABLE_COLUMNS = %w(id title extension size modified version workflow author).freeze
DEFAULT_COLUMNS = %w(title size modified version workflow author).freeze
scope :visible, -> { where(:deleted => STATUS_ACTIVE) } scope :visible, -> { where(:deleted => STATUS_ACTIVE) }
scope :deleted, -> { where(:deleted => STATUS_DELETED) } scope :deleted, -> { where(:deleted => STATUS_DELETED) }
@ -69,7 +69,7 @@ class DmsfFolder < ActiveRecord::Base
validates :title, :presence => true validates :title, :presence => true
validates_uniqueness_of :title, :scope => [:dmsf_folder_id, :project_id, :deleted], validates_uniqueness_of :title, :scope => [:dmsf_folder_id, :project_id, :deleted],
conditions: -> { where(:deleted => STATUS_ACTIVE) } conditions: -> { where(:deleted => STATUS_ACTIVE) }
validates_format_of :title, :with => @@invalid_characters, validates_format_of :title, :with => INVALID_CHARACTERS,
:message => l(:error_contains_invalid_character) :message => l(:error_contains_invalid_character)
validate :check_cycle validate :check_cycle
@ -296,6 +296,91 @@ class DmsfFolder < ActiveRecord::Base
url_links.visible.count url_links.visible.count
end end
def self.is_column_on?(column)
columns = Setting.plugin_redmine_dmsf['dmsf_columns']
columns = DmsfFolder::DEFAULT_COLUMNS unless columns
columns.include? column
end
def custom_value(custom_field)
self.custom_field_values.each do |cv|
return cv.value if cv.custom_field == custom_field
end
nil
end
def self.get_column_position(column)
pos = 0
# 0 - checkbox
# 1 - id
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('id')
pos += 1
end
# 2 - title
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('title')
pos += 1
return pos if column == 'title'
else
return nil if column == 'title'
end
# 3 - extension
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('extension')
pos += 1
end
# 4 - size
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('size')
pos += 1
return pos if column == 'size'
else
return nil if column == 'size'
end
# 5 - modified
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('modified')
pos += 1
return pos if column == 'modified'
else
return nil if column == 'modified'
end
# 6 - version
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('version')
pos += 1
return pos if column == 'version'
else
return nil if column == 'version'
end
# 7 - workflow
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('workflow')
pos += 1
end
# 8 - author
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('author')
pos += 1
end
# 9 - custom fields
cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField')
cfs.each do |c|
if DmsfFolder.is_column_on?(c.name)
pos += 1
end
end
# 10 - commands
pos += 1
return pos if column == 'commands'
# 11 - (position)
pos += 1
return pos if column == 'position'
# 12 - (size)
pos += 1
return pos if column == 'size_calculated'
# 13 - (modified)
pos += 1
return pos if column == 'modified_calculated'
# 14 - (version)
pos += 1
return pos if column == 'version_calculated'
nil
end
private private
def self.directory_subtree(tree, folder, level, current_folder) def self.directory_subtree(tree, folder, level, current_folder)

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -25,39 +25,65 @@
<td class="dmsf_checkbox"><%= check_box_tag(name, id, false, <td class="dmsf_checkbox"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_zip_download_or_email), :id => "subfolder_#{id}") %></td> :title => l(:title_check_for_zip_download_or_email), :id => "subfolder_#{id}") %></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<% if @tree_view %> <td class="id"><%= link_to(subfolder.id, edit_dmsf_path(:id => project, :folder_id => subfolder)) %></td>
<span class='dmsf_expander' <%= onclick.html_safe %>></span> <% end %>
<% end %> <% if DmsfFolder.is_column_on?('title') %>
<%= link_to(h(title), <td class="dmsf_title">
dmsf_folder_path(:id => project, :folder_id => subfolder), <% if @tree_view %>
:class => 'icon icon-folder', <span class='dmsf_expander' <%= onclick.html_safe %>></span>
:title => subfolder ? h(subfolder.description) : nil) %>
<% if link %>
<div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.path %></div>
<% else %>
<div class="dmsf_filename" title="<%= l(:title_items)%>">[<%= subfolder.items %>]</div>
<% end %>
</td>
<td class="dmsf_size"></td>
<td class="dmsf_modified"><%= format_time(subfolder.modified) if subfolder %>
<% if locked_for_user %>
<% if subfolder.lock.reverse[0].user %>
<%= link_to(image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
user_path(subfolder.lock.reverse[0].user),
:title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user)) %>
<% else %>
<%= content_tag(:span, image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
:title => l(:notice_account_unknown_email)) %>
<% end %> <% end %>
<% elsif locked %> <%= link_to(h(title),
<%= content_tag(:span, image_tag(link ? 'lockedbycurrent_gray.png' : 'lockedbycurrent.png', :plugin => 'redmine_dmsf'), dmsf_folder_path(:id => project, :folder_id => subfolder),
:title => l(:title_locked_by_you)) %> :class => 'icon icon-folder',
<% end %> :title => subfolder ? h(subfolder.description) : nil) %>
</td> <% if link %>
<td class="dmsf_version"></td> <div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.path %></div>
<td class="dmsf_workflow"></td> <% else %>
<td class="dmsf_author"><%= h(subfolder.user) if subfolder %></td> <div class="dmsf_filename" title="<%= l(:title_items)%>">[<%= subfolder.items %>]</div>
<% end %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('extension') %>
<td class="dmsf_extension"></td>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<td class="dmsf_size"></td>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<td class="dmsf_modified"><%= format_time(subfolder.modified) if subfolder %>
<% if locked_for_user %>
<% if subfolder.lock.reverse[0].user %>
<%= link_to(image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
user_path(subfolder.lock.reverse[0].user),
:title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user)) %>
<% else %>
<%= content_tag(:span, image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
:title => l(:notice_account_unknown_email)) %>
<% end %>
<% elsif locked %>
<%= content_tag(:span, image_tag(link ? 'lockedbycurrent_gray.png' : 'lockedbycurrent.png', :plugin => 'redmine_dmsf'),
:title => l(:title_locked_by_you)) %>
<% end %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version"></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow"></td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(subfolder.user) if subfolder %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= subfolder.custom_value(c) %>
</td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<% if @folder_manipulation_allowed %> <% if @folder_manipulation_allowed %>
<% unless locked_for_user %> <% unless locked_for_user %>

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -22,23 +22,49 @@
<td class="dmsf_checkbox"><%= check_box_tag(name, id, false, <td class="dmsf_checkbox"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_restore_or_delete), :id => "subfolder_#{id}") %></td> :title => l(:title_check_for_restore_or_delete), :id => "subfolder_#{id}") %></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<%= content_tag(:span, h(title), <td class="id"><%= link_to(subfolder.id, edit_dmsf_path(:id => project, :folder_id => subfolder)) %></td>
:title => subfolder ? h(subfolder.description) : nil, <% end %>
:class => 'icon icon-folder') %> <% if DmsfFolder.is_column_on?('title') %>
<% if link %> <td class="dmsf_title">
<div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.path %></div> <%= content_tag(:span, h(title),
<% else %> :title => subfolder ? h(subfolder.description) : nil,
<div class="dmsf_filename" title="<%= l(:title_items)%>">[<%= subfolder.items %>]</div> :class => 'icon icon-folder') %>
<% end %> <% if link %>
</td> <div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.path %></div>
<td class="dmsf_size"></td> <% else %>
<td class="dmsf_modified"> <div class="dmsf_filename" title="<%= l(:title_items)%>">[<%= subfolder.items %>]</div>
<%= format_time(subfolder.modified) if subfolder %> <% end %>
</td> </td>
<td class="dmsf_version"></td> <% end %>
<td class="dmsf_workflow"></td> <% if DmsfFolder.is_column_on?('extension') %>
<td class="dmsf_author"><%= h(subfolder.user) %></td> <td class="dmsf_extension"></td>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<td class="dmsf_size"></td>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<td class="dmsf_modified">
<%= format_time(subfolder.modified) if subfolder %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version"></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow"></td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(subfolder.user) %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= subfolder.custom_value(c) %>
</td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<% if @folder_manipulation_allowed %> <% if @folder_manipulation_allowed %>
<% if link %> <% if link %>

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -24,52 +24,80 @@
<td class="dmsf_checkbox"><%= check_box_tag(name, id, false, <td class="dmsf_checkbox"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_zip_download_or_email), :id => "file_#{id}") %></td> :title => l(:title_check_for_zip_download_or_email), :id => "file_#{id}") %></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<% if @tree_view %> <td class="id"><%= link_to(file.id, dmsf_file_path(:id => file)) %></td>
<span class='dmsf_expander'></span> <% end %>
<% end %> <% if DmsfFolder.is_column_on?('title') %>
<% file_view_url = url_for({:controller => :dmsf_files, :action => 'view', :id => file}) %> <td class="dmsf_title">
<%= link_to(h(title), <% if @tree_view %>
file_view_url, <span class='dmsf_expander'></span>
:target => '_blank',
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
:title => h(file.last_revision.try(:tooltip)),
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") %>
<div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
</td>
<td class="dmsf_size"><%= number_to_human_size(file.last_revision.size) %></td>
<td class="dmsf_modified">
<%= format_time(file.last_revision.updated_at) %>
<% if file.locked_for_user? %>
<% if file.lock.reverse[0].user %>
<%= link_to(image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
user_path(file.lock.reverse[0].user),
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user)) %>
<% else %>
<%= content_tag(:span, image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
:title => l(:notice_account_unknown_email)) %>
<% end %> <% end %>
<% elsif file.locked? %> <% file_view_url = url_for({:controller => :dmsf_files, :action => 'view', :id => file}) %>
<%= content_tag(:span, image_tag(link ? 'lockedbycurrent_gray.png' : 'lockedbycurrent.png', :plugin => 'redmine_dmsf'), <%= link_to(h(title),
:title => l(:title_locked_by_you)) %> file_view_url,
<% end %> :target => '_blank',
</td> :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
<td class="dmsf_version" title="<%= file.last_revision.comment %>"><%= file.last_revision.version %></td> :title => h(file.last_revision.try(:tooltip)),
<td class="dmsf_workflow"> 'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_view_url}") %>
<% if wf && @file_approval_allowed %> <div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
<%= link_to( </td>
file.last_revision.workflow_str(false), <% end %>
log_dmsf_workflow_path( <% if DmsfFolder.is_column_on?('extension') %>
:project_id => project.id, <td class="dmsf_extension">
:id => wf.id, <%= $1 if file.last_revision.disk_filename =~ /\.(.+)$/ %>
:dmsf_file_revision_id => file.last_revision.id), </td>
:title => DmsfWorkflow.assignments_to_users_str(wf.next_assignments(file.last_revision.id)), <% end %>
:remote => true) %> <% if DmsfFolder.is_column_on?('size') %>
<% else %> <td class="dmsf_size"><%= number_to_human_size(file.last_revision.size) %></td>
<%= file.last_revision.workflow_str(false) %> <% end %>
<% end %> <% if DmsfFolder.is_column_on?('modified') %>
</td> <td class="dmsf_modified">
<td class="dmsf_author"><%= h(file.last_revision.user) %></td> <%= format_time(file.last_revision.updated_at) %>
<% if file.locked_for_user? %>
<% if file.lock.reverse[0].user %>
<%= link_to(image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
user_path(file.lock.reverse[0].user),
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user)) %>
<% else %>
<%= content_tag(:span, image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'),
:title => l(:notice_account_unknown_email)) %>
<% end %>
<% elsif file.locked? %>
<%= content_tag(:span, image_tag(link ? 'lockedbycurrent_gray.png' : 'lockedbycurrent.png', :plugin => 'redmine_dmsf'),
:title => l(:title_locked_by_you)) %>
<% end %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version" title="<%= file.last_revision.comment %>"><%= file.last_revision.version %></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow">
<% if wf && @file_approval_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 %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(file.last_revision.user) %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= file.custom_value(c) %>
</td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<% if @file_manipulation_allowed %> <% if @file_manipulation_allowed %>
<%= link_to(image_tag('filedetails.png', :plugin => 'redmine_dmsf'), <%= link_to(image_tag('filedetails.png', :plugin => 'redmine_dmsf'),

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -22,21 +22,49 @@
<td class="dmsf_checkbox"><%= check_box_tag(name, id, false, <td class="dmsf_checkbox"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_restore_or_delete), :id => "file_#{id}") %></td> :title => l(:title_check_for_restore_or_delete), :id => "file_#{id}") %></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<%= content_tag(:span, h(title), <td class="id"><%= file.id %></td>
:title => h(file.last_revision.try(:tooltip)), <% end %>
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %> <% if DmsfFolder.is_column_on?('title') %>
<div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div> <td class="dmsf_title">
</td> <%= content_tag(:span, h(title),
<td class="dmsf_size"><%= number_to_human_size(file.last_revision.size) %></td> :title => h(file.last_revision.try(:tooltip)),
<td class="dmsf_modified"> :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %>
<%= format_time(file.last_revision.updated_at) %> <div class="dmsf_filename" title="<%= l(:title_filename_for_download)%>"><%= h(link ? link.path : file.display_name) %></div>
</td> </td>
<td class="dmsf_version" title="<%= file.last_revision.comment %>"><%= file.last_revision.version %></td> <% end %>
<td class="dmsf_workflow"> <% if DmsfFolder.is_column_on?('extension') %>
<%= file.last_revision.workflow_str(false) %> <td class="dmsf_extension">
</td> <%= $1 if file.last_revision.disk_filename =~ /\.(.+)$/ %>
<td class="dmsf_author"><%= h(file.last_revision.user) %></td> </td>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<td class="dmsf_size"><%= number_to_human_size(file.last_revision.size) %></td>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<td class="dmsf_modified">
<%= format_time(file.last_revision.updated_at) %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version" title="<%= file.last_revision.comment %>"><%= file.last_revision.version %></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow">
<%= file.last_revision.workflow_str(false) %>
</td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(file.last_revision.user) %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= file.custom_value(c) %>
</td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<% if @file_manipulation_allowed %> <% if @file_manipulation_allowed %>
<% if link %> <% if link %>

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -26,17 +26,41 @@
<th class="dmsf_checkbox dmsf_th"> <th class="dmsf_checkbox dmsf_th">
<input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_zip_download_or_email) %>" type="checkbox" /> <input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_zip_download_or_email) %>" type="checkbox" />
</th> </th>
<th class ="dmsf_th"><%= l(:link_title) %></th> <% if DmsfFolder.is_column_on?('id') %>
<th class ="dmsf_th"><%= l(:link_size) %></th> <th class="dmsf_th">#</th>
<th class ="dmsf_th"><%= l(:link_modified) %></th> <% end %>
<th title="<%= l(:label_dmsf_version) %>" class ="dmsf_th"><%= l(:link_ver) %></th> <% if DmsfFolder.is_column_on?('title') %>
<th class ="dmsf_th"><%= l(:link_workflow) %></th> <th class="dmsf_th"><%= l(:link_title) %></th>
<th class ="dmsf_th"><%= l(:link_author) %></th> <% end %>
<th class ="dmsf_th"></th> <% if DmsfFolder.is_column_on?('extension') %>
<th class="dmsf_invisible"></th> <th class="dmsf_th"><%= l(:link_extension) %></th>
<th class="dmsf_invisible"></th> <% end %>
<th class="dmsf_invisible"></th> <% if DmsfFolder.is_column_on?('size') %>
<th class="dmsf_invisible"></th> <th class="dmsf_th"><%= l(:link_size) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<th class="dmsf_th"><%= l(:link_modified) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<th title="<%= l(:label_dmsf_version) %>" class ="dmsf_th"><%= l(:link_ver) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<th class="dmsf_th"><%= l(:link_workflow) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<th class="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= h(c.name) %></th>
<% end %>
<% end %>
<th class ="dmsf_th"><%# controls %></th>
<th class="dmsf_invisible"><%# position %></th>
<th class="dmsf_invisible"><%# size %></th>
<th class="dmsf_invisible"><%# updated %></th>
<th class="dmsf_invisible"><%# version %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -26,17 +26,41 @@
<th class="dmsf_checkbox dmsf_th"> <th class="dmsf_checkbox dmsf_th">
<input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_zip_download_or_email) %>" type="checkbox" /> <input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_zip_download_or_email) %>" type="checkbox" />
</th> </th>
<th class ="dmsf_th"><%= l(:link_title) %></th> <% if DmsfFolder.is_column_on?('id') %>
<th class ="dmsf_th"><%= l(:link_size) %></th> <th class="dmsf_th">#</th>
<th class ="dmsf_th"><%= l(:link_modified) %></th> <% end %>
<th title="<%= l(:label_dmsf_version) %>" class="dmsf_th"><%= l(:link_ver) %></th> <% if DmsfFolder.is_column_on?('title') %>
<th class ="dmsf_th"><%= l(:link_workflow) %></th> <th class ="dmsf_th"><%= l(:link_title) %></th>
<th class ="dmsf_th"><%= l(:link_author) %></th> <% end %>
<% if DmsfFolder.is_column_on?('extension') %>
<th class="dmsf_th"><%= l(:link_extension) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<th class ="dmsf_th"><%= l(:link_size) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<th class ="dmsf_th"><%= l(:link_modified) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<th title="<%= l(:label_dmsf_version) %>" class="dmsf_th"><%= l(:link_ver) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<th class ="dmsf_th"><%= l(:link_workflow) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<th class ="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= c.name %></th>
<% end %>
<% end %>
<th class ="dmsf_th"><%# controls %></th> <th class ="dmsf_th"><%# controls %></th>
<th class="dmsf_invisible"><%# position %></th> <th class="dmsf_invisible"><%# position %></th>
<th class="dmsf_invisible"><%# size %></th> <th class="dmsf_invisible"><%# size %></th>
<th class="dmsf_invisible"><%# updated %></th> <th class="dmsf_invisible"><%# updated %></th>
<th class="dmsf_invisible"><%# revision %></th> <th class="dmsf_invisible"><%# version %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -21,24 +21,48 @@
%> %>
<td class="dmsf_checkbox"></td> <td class="dmsf_checkbox"></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<% if @tree_view %> <td class="id"></td>
<span class='dmsf_expander' <%= onclick.html_safe %>></span> <% end %>
<% end %> <% if DmsfFolder.is_column_on?('title') %>
<%= link_to(h(title), <td class="dmsf_title">
link.external_url, <% if @tree_view %>
:target => '_blank', <span class='dmsf_expander' <%= onclick.html_safe %>></span>
:class => 'icon dmsf_icon-link') %> <% end %>
<div class="dmsf_filename" title="<%= l(:label_target_folder) %>"> <%= link_to(h(title),
<%= link.external_url %> link.external_url,
</div> :target => '_blank',
<%= '</span>'.html_safe if @tree_view %> :class => 'icon dmsf_icon-link') %>
</td> <div class="dmsf_filename" title="<%= l(:label_target_folder) %>">
<td class="dmsf_size"></td> <%= link.external_url %>
<td class="dmsf_modified"><%= format_time(link.updated_at) %></td> </div>
<td class="dmsf_version"></td> <%= '</span>'.html_safe if @tree_view %>
<td class="dmsf_workflow"></td> </td>
<td class="dmsf_author"><%= h(link.user) %></td> <% end %>
<% if DmsfFolder.is_column_on?('extension') %>
<td class="dmsf_extension"></td>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<td class="dmsf_size"></td>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<td class="dmsf_modified"><%= format_time(link.updated_at) %></td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version"></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow"></td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(link.user) %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf"></td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<span class="icon"></span> <span class="icon"></span>
<span class="icon"></span> <span class="icon"></span>

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -22,18 +22,42 @@
<td class="dmsf_checkbox"><%= check_box_tag(name, id, false, <td class="dmsf_checkbox"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_restore_or_delete)) %></td> :title => l(:title_check_for_restore_or_delete)) %></td>
<td class="dmsf_title"> <% if DmsfFolder.is_column_on?('id') %>
<%= link_to(h(title), <td class="id"></td>
link.external_url, <% end %>
:target => '_blank', <% if DmsfFolder.is_column_on?('title') %>
:class => 'icon dmsf_icon-link') %> <td class="dmsf_title">
<div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.external_url %></div> <%= link_to(h(title),
</td> link.external_url,
<td class="dmsf_size"></td> :target => '_blank',
<td class="dmsf_modified"><%= format_time(link.updated_at) %></td> :class => 'icon dmsf_icon-link') %>
<td class="dmsf_version"></td> <div class="dmsf_filename" title="<%= l(:label_target_folder)%>"><%= link.external_url %></div>
<td class="dmsf_workflow"></td> </td>
<td class="dmsf_author"><%= h(link.user) %></td> <% end %>
<% if DmsfFolder.is_column_on?('extension') %>
<td class="dmsf_extension"></td>
<% end %>
<% if DmsfFolder.is_column_on?('size') %>
<td class="dmsf_size"></td>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<td class="dmsf_modified"><%= format_time(link.updated_at) %></td>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<td class="dmsf_version"></td>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<td class="dmsf_workflow"></td>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(link.user) %></td>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf"></td>
<% end %>
<% end %>
<td class="dmsf_buttons"> <td class="dmsf_buttons">
<% if @file_manipulation_allowed %> <% if @file_manipulation_allowed %>
<%= link_to(image_tag('restore.png', :plugin => 'redmine_dmsf'), <%= link_to(image_tag('restore.png', :plugin => 'redmine_dmsf'),

View File

@ -5,7 +5,7 @@
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -132,6 +132,17 @@
<%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %> <%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %> <%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
<% title = DmsfFolder.get_column_position('title') %>
<% position = DmsfFolder.get_column_position('position') %>
<% commands = DmsfFolder.get_column_position('commands') %>
<% position = DmsfFolder.get_column_position('position') %>
<% version = DmsfFolder.get_column_position('version') %>
<% size_calculated = DmsfFolder.get_column_position('size_calculated') %>
<% modified_calculated = DmsfFolder.get_column_position('modified_calculated') %>
<% version_calculated = DmsfFolder.get_column_position('version_calculated') %>
<% size = DmsfFolder.get_column_position('size') %>
<% modified = DmsfFolder.get_column_position('modified') %>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#browser').dataTable({ $('#browser').dataTable({
@ -141,14 +152,22 @@
}, },
'bAutoWidth': false, 'bAutoWidth': false,
'bPaginate': false, 'bPaginate': false,
'aaSorting': [[1, 'asc']], <% if title %>
'aaSortingFixed': [[ 8, 'asc']], 'aaSorting': [[<%= title %>, 'asc']],
<% end %>
'aaSortingFixed': [[ <%= position %>, 'asc']],
'aoColumnDefs': [ 'aoColumnDefs': [
{ 'bSearchable': false, 'aTargets': [0, 7, 8, 9, 10, 11] }, { 'bSearchable': false, 'aTargets': [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
{ 'bSortable': false, 'aTargets': [0, 7] }, { 'bSortable': false, 'aTargets': [0, <%= commands %>] }
{ 'iDataSort': 9, 'aTargets': [ 2 ] }, <% if size %>
{ 'iDataSort': 10, 'aTargets': [ 3 ] }, ,{ 'iDataSort': <%= size_calculated %>, 'aTargets': [ <%= size %> ] }
{ 'iDataSort': 11, 'aTargets': [ 4 ] } <% end %>
<% if modified %>
,{ 'iDataSort': <%= modified_calculated %>, 'aTargets': [ <%= modified %> ] }
<% end %>
<% if version %>
,{ 'iDataSort': <%= version_calculated %>, 'aTargets': [ <%= version %> ] }
<% end %>
], ],
'fnInitComplete': function() { 'fnInitComplete': function() {
$('#dmsf_buttons').prependTo($('#browser_wrapper div.fg-toolbar')[0]); $('#dmsf_buttons').prependTo($('#browser_wrapper div.fg-toolbar')[0]);

View File

@ -3,7 +3,7 @@
# #
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -50,17 +50,41 @@
<th class="dmsf_checkbox dmsf_th"> <th class="dmsf_checkbox dmsf_th">
<input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_restore_or_delete) %>" type="checkbox" /> <input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_restore_or_delete) %>" type="checkbox" />
</th> </th>
<th class="dmsf_th"><%= l(:link_title) %></th> <% if DmsfFolder.is_column_on?('id') %>
<th class="dmsf_th"><%= l(:link_size) %></th> <th class="dmsf_th">#</th>
<th class="dmsf_th"><%= l(:link_modified) %></th> <% end %>
<th title="<%= l(:label_dmsf_version) %>" class="dmsf_th"><%= l(:link_ver) %></th> <% if DmsfFolder.is_column_on?('title') %>
<th class="dmsf_th"><%= l(:link_workflow) %></th> <th class="dmsf_th"><%= l(:link_title) %></th>
<th class="dmsf_th"><%= l(:link_author) %></th> <% end %>
<th class="dmsf_th"></th> <% if DmsfFolder.is_column_on?('extension') %>
<th class="dmsf_invisible"></th> <th class="dmsf_th"><%= l(:link_extension) %></th>
<th class="dmsf_invisible"></th> <% end %>
<th class="dmsf_invisible"></th> <% if DmsfFolder.is_column_on?('size') %>
<th class="dmsf_invisible"></th> <th class="dmsf_th"><%= l(:link_size) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('modified') %>
<th class="dmsf_th"><%= l(:link_modified) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('version') %>
<th title="<%= l(:label_dmsf_version) %>" class="dmsf_th"><%= l(:link_ver) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('workflow') %>
<th class="dmsf_th"><%= l(:link_workflow) %></th>
<% end %>
<% if DmsfFolder.is_column_on?('author') %>
<th class="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs.each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= h(c.name) %></th>
<% end %>
<% end %>
<th class ="dmsf_th"><%# controls %></th>
<th class="dmsf_invisible"><%# position %></th>
<th class="dmsf_invisible"><%# size %></th>
<th class="dmsf_invisible"><%# updated %></th>
<th class="dmsf_invisible"><%# version %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -156,6 +180,17 @@
<%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %> <%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %> <%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
<% title = DmsfFolder.get_column_position('title') %>
<% position = DmsfFolder.get_column_position('position') %>
<% commands = DmsfFolder.get_column_position('commands') %>
<% position = DmsfFolder.get_column_position('position') %>
<% version = DmsfFolder.get_column_position('version') %>
<% size_calculated = DmsfFolder.get_column_position('size_calculated') %>
<% modified_calculated = DmsfFolder.get_column_position('modified_calculated') %>
<% version_calculated = DmsfFolder.get_column_position('version_calculated') %>
<% size = DmsfFolder.get_column_position('size') %>
<% modified = DmsfFolder.get_column_position('modified') %>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#browser').dataTable({ $('#browser').dataTable({
@ -165,15 +200,23 @@
}, },
'bAutoWidth': false, 'bAutoWidth': false,
'bPaginate': false, 'bPaginate': false,
'aaSorting': [[1,'asc']], <% if title %>
'aaSortingFixed': [[8,'asc']], 'aaSorting': [[<%= title %>, 'asc']],
'aoColumnDefs': [ <% end %>
{ 'bSearchable': false, 'aTargets': [0, 7, 8, 9] }, 'aaSortingFixed': [[ <%= position %>, 'asc']],
{ 'bSortable': false, 'aTargets': [0, 7, 8] }, 'aoColumnDefs': [
{ 'iDataSort': 9, 'aTargets': [ 2 ] }, { 'bSearchable': false, 'aTargets': [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
{ 'iDataSort': 10, 'aTargets': [ 3 ] }, { 'bSortable': false, 'aTargets': [0, <%= commands %>] }
{ 'iDataSort': 11, 'aTargets': [ 4 ] } <% if size %>
], ,{ 'iDataSort': <%= size_calculated %>, 'aTargets': [ <%= size %> ] }
<% end %>
<% if modified %>
,{ 'iDataSort': <%= modified_calculated %>, 'aTargets': [ <%= modified %> ] }
<% end %>
<% if version %>
,{ 'iDataSort': <%= version_calculated %>, 'aTargets': [ <%= version %> ] }
<% end %>
],
'fnInitComplete': function() { 'fnInitComplete': function() {
$('div.dmsf_controls').prependTo($('#browser_wrapper div.fg-toolbar')[0]); $('div.dmsf_controls').prependTo($('#browser_wrapper div.fg-toolbar')[0]);
}, },

View File

@ -1,8 +1,11 @@
<%# Redmine plugin for Document Management System "Features" <%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-15 Karel Picman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Picman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -16,7 +19,12 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<em class="info">
<%= l(:label_general) %>
</em>
<p> <p>
<%= content_tag(:label, l(:label_maximum_files_upload)) %> <%= content_tag(:label, l(:label_maximum_files_upload)) %>
@ -121,6 +129,28 @@
</p> </p>
<hr/> <hr/>
<em class="info">
<%= l(:menu_dmsf) %> <%= l(:field_column_names) %>
</em>
<p>
<%= content_tag(:label, l(:field_column_names)) %>
<% columns = DmsfFolder::AVAILABLE_COLUMNS.dup %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% columns.concat(cfs.map{ |c| c.name }) %>
<% selected_columns = @settings[:dmsf_columns] %>
<% selected_columns = DmsfFolder::DEFAULT_COLUMNS unless selected_columns %>
<% columns.each_with_index do |column, i| %>
<%= check_box_tag('settings[dmsf_columns][]', column, selected_columns.include?(column)) %>
<%= h column.capitalize %>
<br/>
<% end %>
</p>
<hr/>
<em class="info">
<%= l(:label_webdav) %>
</em>
<p> <p>
<%= content_tag(:label, l(:label_webdav)) %> <%= content_tag(:label, l(:label_webdav)) %>
@ -149,6 +179,9 @@
<% end %> <% end %>
<hr/> <hr/>
<em class="info">
<%= l(:label_full_text) %>
</em>
<% begin %> <% begin %>
<% require 'xapian' %> <% require 'xapian' %>

View File

@ -335,3 +335,7 @@ cs:
error_maximum_upload_filecount: "Nelze nahrát více než %{filecount} soubor(ů)." error_maximum_upload_filecount: "Nelze nahrát více než %{filecount} soubor(ů)."
label_public_urls: Veřejné URL platné do label_public_urls: Veřejné URL platné do
label_webdav: WebDAV
label_full_text: Full-textové vyhledávání
link_extension: Příp.

View File

@ -335,3 +335,7 @@ de:
error_maximum_upload_filecount: "Nicht mehr als %{filecount} Datai(en) kann man hochladen." error_maximum_upload_filecount: "Nicht mehr als %{filecount} Datai(en) kann man hochladen."
label_public_urls: Öffentliches URLs gültig bis label_public_urls: Öffentliches URLs gültig bis
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ en:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ es:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ fr:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ it: # Italian strings thx 2 Matteo Arceci!
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ ja:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ pl:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ pt-BR:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ ru:
error_maximum_upload_filecount: "Не более %{filecount} файла(ов) может быть загружено." error_maximum_upload_filecount: "Не более %{filecount} файла(ов) может быть загружено."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ sl:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ zh-TW:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

View File

@ -335,3 +335,7 @@ zh:
error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded." error_maximum_upload_filecount: "No more than %{filecount} file(s) can be uploaded."
label_public_urls: Public URLs valid to label_public_urls: Public URLs valid to
label_webdav: WebDAV
label_full_text: Full-text search
link_extension: Ext

31
init.rb
View File

@ -4,7 +4,7 @@
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -28,26 +28,27 @@ Redmine::Plugin.register :redmine_dmsf do
name 'DMSF' name 'DMSF'
author 'Vít Jonáš / Daniel Munn / Karel Pičman' author 'Vít Jonáš / Daniel Munn / Karel Pičman'
description 'Document Management System Features' description 'Document Management System Features'
version '1.5.8' version '1.5.9 - devel'
url 'http://www.redmine.org/plugins/dmsf' url 'http://www.redmine.org/plugins/dmsf'
author_url 'https://github.com/danmunn/redmine_dmsf/graphs/contributors' author_url 'https://github.com/danmunn/redmine_dmsf/graphs/contributors'
requires_redmine :version_or_higher => '3.3.0' requires_redmine :version_or_higher => '3.3.0'
settings :partial => 'settings/dmsf_settings', settings :partial => 'settings/dmsf_settings',
:default => { :default => {
'dmsf_max_file_upload' => '0', 'dmsf_max_file_upload' => '0',
'dmsf_max_file_download' => '0', 'dmsf_max_file_download' => '0',
'dmsf_max_email_filesize' => '0', 'dmsf_max_email_filesize' => '0',
'dmsf_max_ajax_upload_filesize' => '100', 'dmsf_max_ajax_upload_filesize' => '100',
'dmsf_storage_directory' => Rails.root.join('files/dmsf').to_s, 'dmsf_storage_directory' => Rails.root.join('files/dmsf').to_s,
'dmsf_index_database' => Rails.root.join('files/dmsf_index').to_s, 'dmsf_index_database' => Rails.root.join('files/dmsf_index').to_s,
'dmsf_stemming_lang' => 'english', 'dmsf_stemming_lang' => 'english',
'dmsf_stemming_strategy' => 'STEM_NONE', 'dmsf_stemming_strategy' => 'STEM_NONE',
'dmsf_webdav' => '1', 'dmsf_webdav' => '1',
'dmsf_display_notified_recipients' => 0, 'dmsf_display_notified_recipients' => 0,
'dmsf_global_title_format' => '' 'dmsf_global_title_format' => '',
} 'dmsf_columns' => %w(title size modified version workflow author)
}
menu :project_menu, :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, :param => :id menu :project_menu, :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, :param => :id