This commit is contained in:
Karel Pičman 2020-02-07 17:25:05 +01:00
parent 42fdf27303
commit 67e2fe9561
42 changed files with 705 additions and 164 deletions

View File

@ -25,6 +25,7 @@ gem 'zip-zip'
gem 'simple_enum'
gem 'uuidtools'
gem 'dalli'
gem 'active_record_union'
# Redmine extensions
unless %w(easyproject easy_gantt).any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) }

View File

@ -37,8 +37,10 @@ class DmsfController < ApplicationController
accept_api_auth :show, :create, :save, :delete
helper :all
helper :all # TODO: Is it needed?
helper :dmsf_folder_permissions
helper :queries
include QueriesHelper
def permissions
render_403 unless DmsfFolder.permissions?(@folder, false)
@ -71,7 +73,31 @@ class DmsfController < ApplicationController
end
def show
Rails.logger.info ">>> RLF get: #{cookies[:dmsf_switch_rlf]}"
@rlf = cookies[:dmsf_switch_rlf] == 'true'
if @rlf
@query = DmsfQuery.new(name: 'Dmsf', dmsf_folder: @folder, project: @project)
if (@folder && @folder.deleted?) || (params[:folder_title].present? && !@folder)
render_404
return
end
respond_to do |format|
format.html {
@dmsf_count = @query.dmsf_count
@dmsf_pages = Paginator.new @issue_count, per_page_option, params['page']
@dmsf_nodes = @query.dmsf_nodes(offset: @dmsf_pages.offset, limit: @dmsf_pages.per_page)
render layout: !request.xhr?
}
format.api
format.csv {
filename = @project.name
filename << "_#{@folder.title}" if @folder
filename << DateTime.current.strftime('_%Y%m%d%H%M%S.csv')
send_data(DmsfHelper.dmsf_to_csv(@folder ? @folder : @project, params[:settings][:dmsf_columns]),
:type => 'text/csv; header=present', :filename => filename)
}
end
return
end
get_display_params
if (@folder && @folder.deleted?) || (params[:folder_title].present? && !@folder)
render_404

View File

@ -0,0 +1,29 @@
# encode: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 DmsfAuthorQueryColumn < QueryColumn
def value_object(object)
"#{object.firstname} #{object.lastname}"
end
end

View File

@ -580,7 +580,7 @@ class DmsfFile < ActiveRecord::Base
end
end
# Custom fields
CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c|
DmsfFileRevisionCustomField.visible.order(:position).each do |c|
csv << custom_value(c).value if columns.include?(c.name)
end
csv

View File

@ -317,6 +317,7 @@ class DmsfFolder < ActiveRecord::Base
last_update
end
# Number of items in the folder
def items
dmsf_folders.visible.where(project_id: project_id).all.size +
@ -401,7 +402,7 @@ class DmsfFolder < ActiveRecord::Base
return nil if column == 'author'
end
# 9 - custom fields
CustomField.where(type: 'DmsfFileRevisionCustomField').each do |c|
DmsfFileRevisionCustomField.visible.each do |c|
if DmsfFolder.is_column_on?(c.name)
pos += 1
end
@ -460,7 +461,7 @@ class DmsfFolder < ActiveRecord::Base
# Revision
csv << '' if columns.include?(l(:label_last_revision_id))
# Custom fields
CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c|
DmsfFileRevisionCustomField.visible.order(:position).each do |c|
csv << custom_value(c).value if columns.include?(c.name)
end
csv
@ -575,6 +576,10 @@ class DmsfFolder < ActiveRecord::Base
end
end
def css_classes
'dir'
end
private
def self.directory_subtree(tree, folder, level, current_folder)

View File

@ -192,7 +192,7 @@ class DmsfLink < ActiveRecord::Base
# Revision
csv << '' if columns.include?(l(:label_last_revision_id))
# Custom fields
CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c|
DmsfFileRevisionCustomField.visible.order(:position).each do |c|
csv << '' if columns.include?(c.name)
end
end

View File

@ -0,0 +1,29 @@
# encode: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 DmsfModifiedQueryColumn < QueryColumn
def value_object(object)
object.updated
end
end

238
app/models/dmsf_query.rb Normal file
View File

@ -0,0 +1,238 @@
# encode: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 DmsfQuery < Query
attr_accessor :dmsf_folder, :project
# Standard columns
self.available_columns = [
QueryColumn.new(:id, sortable: 'id', caption: '#'),
DmsfTitleQueryColumn.new(:title, frozen: true),
QueryColumn.new(:extension),
QueryColumn.new(:size),
DmsfModifiedQueryColumn.new(:modified),
DmsfVersionQueryColumn.new(:version),
QueryColumn.new(:workflow),
DmsfAuthorQueryColumn.new(:author),
]
def initialize(attributes)
super attributes
self.sort_criteria = []
self.filters = {}
@deleted = false
@dmsf_folder_id = @dmsf_folder ? @dmsf_folder.id : nil
end
######################################################################################################################
# Inherited
#
def available_columns
unless @available_columns
@available_columns = self.class.available_columns.dup
@available_columns += DmsfFileRevisionCustomField.visible.collect { |cf| QueryCustomFieldColumn.new(cf) }
end
@available_columns
end
def default_columns_names
unless @default_column_names
@default_column_names = []
columns = available_columns
if columns
columns.each do |column|
if DmsfFolder.is_column_on?(column.name.to_s)
@default_column_names << column.name.to_sym
end
end
end
end
@default_column_names
end
def default_sort_criteria
[['title', 'desc']]
end
def base_scope
unless @scope
@scope = [dmsf_folders_scope, dmsf_folder_links_scope, dmsf_files_scope, dmsf_file_links_scope, dmsf_url_links_scope].inject(:union_all)
end
@scope
end
# Returns the issue count
def dmsf_count
base_scope.count
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
end
def type
'DmsfQuery'
end
######################################################################################################################
# New
def dmsf_nodes(options={})
nodes = base_scope.
limit(options[:limit]).
offset(options[:offset])
end
def extra_columns
[]
end
private
def dmsf_folders_scope
cf_columns = +''
DmsfFileRevisionCustomField.visible.order(:position).pluck(:id, :name).each do |id, name|
cf_columns << ",(SELECT value from custom_values WHERE custom_field_id = #{id} AND customized_type = 'DmsfFolder' AND customized_id = dmsf_folders.id) AS `#{name}`"
end
DmsfFolder.
select(%{
dmsf_folders.id AS id,
dmsf_folders.title AS title,
NULL AS filename,
NULL AS extensions,
NULL AS size,
dmsf_folders.updated_at AS updated,
NULL AS major_version,
NULL AS minor_version,
NULL AS workflow,
users.firstname AS firstname,
users.lastname AS lastname,
'DmsfFolder' AS type,
0 AS sort #{cf_columns}}).
joins('LEFT JOIN users ON dmsf_folders.user_id = users.id').
where(dmsf_folders: { project_id: @project.id, dmsf_folder_id: @dmsf_folder_id, deleted: @deleted })
end
def dmsf_folder_links_scope
cf_columns = +''
DmsfFileRevisionCustomField.visible.order(:position).pluck(:id, :name).each do |id, name|
cf_columns << ",(SELECT value from custom_values WHERE custom_field_id = #{id} AND customized_type = 'DmsfFolder' AND customized_id = dmsf_folders.id) AS `#{name}`"
end
DmsfLink.
select(%{
dmsf_folders.id AS id,
dmsf_folders.title AS title,
NULL AS filename,
NULL AS extensions,
NULL AS size,
dmsf_folders.updated_at AS updated,
NULL AS major_version,
NULL AS minor_version,
NULL AS workflow,
users.firstname AS firstname,
users.lastname AS lastname,
'DmsfFolderLink' AS type,
0 AS sort #{cf_columns}}).
joins('JOIN dmsf_folders ON dmsf_links.target_id = dmsf_folders.id').
joins('LEFT JOIN users ON dmsf_folders.user_id = users.id ').
where(dmsf_links: { target_type: 'DmsfFolder', project_id: @project.id, dmsf_folder_id: @dmsf_folder_id,
deleted: @deleted })
end
def dmsf_files_scope
cf_columns = +''
DmsfFileRevisionCustomField.visible.order(:position).pluck(:id, :name).each do |id, name|
cf_columns << ",(SELECT value from custom_values WHERE custom_field_id = #{id} AND customized_type = 'DmsfFolder' AND customized_id = dmsf_files.id) AS `#{name}`"
end
DmsfFile.
select(%{
dmsf_files.id AS id,
dmsf_file_revisions.name AS title,
dmsf_file_revisions.disk_filename AS filename,
SUBSTR(dmsf_file_revisions.disk_filename, POSITION('.' IN dmsf_file_revisions.disk_filename) + 1, LENGTH(dmsf_file_revisions.disk_filename) - POSITION('.' IN dmsf_file_revisions.disk_filename)) AS extensions,
dmsf_file_revisions.size AS size,
dmsf_file_revisions.updated_at AS updated,
dmsf_file_revisions.major_version AS major_version,
dmsf_file_revisions.minor_version AS minor_version,
dmsf_file_revisions.workflow AS workflow,
users.firstname AS firstname,
users.lastname AS lastname,
'DmsfFile' AS type,
1 AS sort #{cf_columns}}).
joins(:dmsf_file_revisions).
joins('LEFT JOIN users ON dmsf_file_revisions.user_id = users.id ').
where('dmsf_file_revisions.created_at = (SELECT MAX(r.created_at) FROM dmsf_file_revisions r WHERE r.dmsf_file_id = dmsf_file_revisions.dmsf_file_id)').
where(dmsf_files: { project_id: @project.id, dmsf_folder_id: @dmsf_folder_id, deleted: @deleted })
end
def dmsf_file_links_scope
cf_columns = +''
DmsfFileRevisionCustomField.visible.order(:position).pluck(:id, :name).each do |id, name|
cf_columns << ",(SELECT value from custom_values WHERE custom_field_id = #{id} AND customized_type = 'DmsfFolder' AND customized_id = dmsf_files.id) AS `#{name}`"
end
DmsfLink.
select(%{
dmsf_files.id AS id,
dmsf_links.name AS title,
dmsf_file_revisions.disk_filename AS filename,
SUBSTR(dmsf_file_revisions.disk_filename, POSITION('.' IN dmsf_file_revisions.disk_filename) + 1, LENGTH(dmsf_file_revisions.disk_filename) - POSITION('.' IN dmsf_file_revisions.disk_filename)) AS extensions,
dmsf_file_revisions.size AS size,
dmsf_file_revisions.updated_at AS updated,
dmsf_file_revisions.major_version AS major_version,
dmsf_file_revisions.minor_version AS minor_version,
dmsf_file_revisions.workflow AS workflow,
users.firstname AS firstname,
users.lastname AS lastname,
'DmsfFileLink' AS type,
1 AS sort #{cf_columns}}).
joins('JOIN dmsf_files ON dmsf_files.id = dmsf_links.target_id').
joins('JOIN dmsf_file_revisions ON dmsf_file_revisions.dmsf_file_id = dmsf_files.id').
joins('LEFT JOIN users ON dmsf_file_revisions.user_id = users.id ').
where('dmsf_file_revisions.created_at = (SELECT MAX(r.created_at) FROM dmsf_file_revisions r WHERE r.dmsf_file_id = dmsf_file_revisions.dmsf_file_id)').
where(dmsf_files: { project_id: @project.id, dmsf_folder_id: @dmsf_folder_id, deleted: @deleted })
end
def dmsf_url_links_scope
cf_columns = +''
DmsfFileRevisionCustomField.visible.order(:position).pluck(:name).each do |name|
cf_columns << ",NULL AS `#{name}`"
end
DmsfLink.
select(%{
dmsf_links.id AS id,
dmsf_links.name AS title,
dmsf_links.external_url AS filename,
NULL AS extensions,
NULL AS size,
dmsf_links.updated_at AS updated,
NULL AS major_version,
NULL AS minor_version,
NULL AS workflow,
users.firstname AS firstname,
users.lastname AS lastname,
'DmsfUrlLink' AS type,
1 AS sort #{cf_columns}}).
joins('LEFT JOIN users ON dmsf_links.user_id = users.id ').
where(target_type: 'DmsfUrl', project_id: @project.id, dmsf_folder_id: @dmsf_folder_id, deleted: @deleted)
end
end

View File

@ -0,0 +1,29 @@
# encode: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 DmsfTitleQueryColumn < QueryColumn
def css_classes
'dmsf_title'
end
end

View File

@ -0,0 +1,29 @@
# encode: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 DmsfVersionQueryColumn < QueryColumn
def value_object(object)
"#{object.major_version}.#{object.minor_version}" if object.major_version && object.minor_version
end
end

View File

@ -72,7 +72,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(subfolder.user) if subfolder %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= show_value(subfolder.custom_value(c)) if subfolder %>

View File

@ -56,7 +56,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(subfolder.user) if subfolder %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= show_value(subfolder.custom_value(c)) if subfolder %>

View File

@ -76,7 +76,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(file.last_revision.user) %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= show_value file.custom_value(c) %>

View File

@ -56,7 +56,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(file.last_revision.user) %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf">
<%= show_value file.custom_value(c) %>

View File

@ -53,7 +53,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<th class="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= h(c.name) %></th>
<% end %>

View File

@ -0,0 +1,57 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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.
%>
<% query_options = nil unless defined?(query_options) %>
<% query_options ||= {} %>
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
<%= hidden_field_tag 'back_url', url_for( params: request.query_parameters), id: nil %>
<%= query_columns_hidden_tags(query) %>
<div class="autoscroll">
<table class="list dmsf odd-even <%= query.css_classes %>">
<thead>
<tr>
<th class="checkbox hide-when-print">
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
</th>
<% query.inline_columns.each do |column| %>
<%= column_header(query, column, query_options) %>
<% end %>
<th class="buttons"></th>
</tr>
</thead>
<tbody>
<% level = 0 %>
<% query.dmsf_nodes.each do |node| %>
<tr id="node-<%= node.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= node.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", node.id, false, id: nil) %></td>
<% query.inline_columns.each do |column| %>
<%= content_tag('td', column_content(column, node), class: column.css_classes) %>
<% end %>
<td class="buttons"><%= link_to_context_menu %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>

View File

@ -53,7 +53,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<th class ="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= c.name %></th>
<% end %>

View File

@ -61,7 +61,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(link.user) %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf"></td>
<% end %>

View File

@ -57,7 +57,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<td class="dmsf_author"><%= h(link.user) %></td>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<td class="dmsf_cf"></td>
<% end %>

View File

@ -90,6 +90,12 @@
</div>
</div>
<% if @query %>
<%= form_tag(dmsf_path(@project, @folder), method: :get, id: 'query_form') do %>
<%= render partial: 'queries/query_form' %>
<% end %>
<%= render partial: 'query_list', locals: { query: @query } %>
<% else %>
<div id="dmsf_ajax_loading" class="ajax-loading"></div>
<%= form_tag(entries_operations_dmsf_path(id: @project, folder_id: @folder), method: :post,
class: 'dmsf_entries', id: 'entries_form', data: { cm_url: dmsf_context_menu_path }) do %>
@ -231,24 +237,25 @@
<% if @file_manipulation_allowed && !@locked_for_user && !@system_folder %>
<%= render(:partial => 'dmsf_upload/multi_upload', local: { rlf: @rlf }) %>
<% end %>
<% unless @system_folder %>
<% end %>
<% unless (@folder && @folder.system) %>
<% other_formats_links do |f| %>
<%= f.link_to 'CSV', :onclick => "showModal('csv-export-options', '350px'); return false;" %>
<%= f.link_to 'CSV', onclick: "showModal('dmsf_csv_export_options', '350px'); return false;" %>
<% end %>
<% end %>
<div id="csv-export-options" style="display:none;">
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
<%= form_tag(dmsf_folder_path(:id => @project, :format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
<div id="dmsf_csv_export_options">
<h3 class="title"><%= l(:label_export_options, export_format: 'CSV') %></h3>
<%= form_tag(dmsf_folder_path(id: @project, format: 'csv'), method: :get, id: 'csv-export-form') do %>
<%= hidden_field_tag(:folder_id, @folder.id) if @folder %>
<div class="tabular">
<%= render(:partial => 'settings/dmsf_columns',
:locals => { :selected_columns => Setting.plugin_redmine_dmsf['dmsf_columns'], :extra_columns => @extra_columns }) %>
<%= render(partial: 'settings/dmsf_columns',
locals: { selected_columns: Setting.plugin_redmine_dmsf['dmsf_columns'],
extra_columns: @extra_columns ? @extra_columns : @query.extra_columns }) %>
</div>
<p class="buttons">
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
<%= submit_tag l(:button_export), name: nil, onclick: "hideModal(this);" %>
<%= submit_tag l(:button_cancel), name: nil, onclick: "hideModal(this);", type: 'button' %>
</p>
<% end %>
</div>

View File

@ -75,7 +75,7 @@
<% if DmsfFolder.is_column_on?('author') %>
<th class="dmsf_th"><%= l(:link_author) %></th>
<% end %>
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
<% DmsfFileRevisionCustomField.visible.order(:position).each do |c| %>
<% if DmsfFolder.is_column_on?(c.name) %>
<th class="dmsf_th"><%= h(c.name) %></th>
<% end %>

View File

@ -29,7 +29,7 @@
<% if index %>
<% columns.insert(0, columns.delete_at(index)) %>
<% end %>
<% cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% cfs = DmsfFileRevisionCustomField.visible.order(:position) %>
<% columns.concat(cfs.map{ |c| c.name }) %>
<% selected_columns = DmsfFolder::DEFAULT_COLUMNS if selected_columns.blank? %>
<% columns.each_with_index do |column, i| %>

View File

@ -414,3 +414,7 @@ div.dmsf_revision_inner_box .attribute .label {
.dmsf_attachments_label{
vertical-align: middle;
}
#dmsf_csv_export_options {
display: none;
}

View File

@ -414,6 +414,8 @@ cs:
label_switch_rlf: Přepni do/z Redmine vzhledu
button_switch: Přepni vzhled
button_edit_content: Upravit obsah
field_workflow: Workflow
field_modified: Aktualizoval
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ de:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ en:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ es:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ fr:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ hu:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ it: # Italian strings thx 2 Matteo Arceci!
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ ja:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ ko:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ nl:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ pl:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ pt-BR:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ ru:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ sl:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ zh-TW:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -414,6 +414,8 @@ zh:
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
button_edit_content: Edit content
field_workflow: Workflow
field_modified: Updated
easy_pages:
modules:

View File

@ -165,8 +165,10 @@ if Redmine::Plugin.installed? :redmine_dmsf
end
end
# WebDAV
# WebDAV workaround for clients checking WebDAV availability in the root
if Redmine::Plugin.installed?(:easy_extensions)
match '/', to: lambda { |env| [405, {}, [env.to_s]] }, via: [:propfind, :options]
end
match '/dmsf', to: lambda { |env| [405, {}, [env.to_s]] }, via: [:propfind, :options]
end
end

View File

@ -32,6 +32,7 @@ require_dependency File.dirname(__FILE__) + '/../app/validators/dmsf_url_validat
# Plugin's patches
require 'redmine_dmsf/patches/projects_helper_patch'
require 'redmine_dmsf/patches/queries_helper_patch'
require 'redmine_dmsf/patches/project_patch'
require 'redmine_dmsf/patches/user_preference_patch'
require 'redmine_dmsf/patches/user_patch'

View File

@ -0,0 +1,52 @@
# encoding: utf-8
# frozen_string_literal: true
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright © 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
#
# 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 RedmineDmsf
module Patches
module QueriesHelperPatch
##################################################################################################################
# Overridden methods
def column_value(column, item, value)
case column.name
when :title
case item.type
when 'DmsfFile', 'DmsfFileLink'
h(value) + content_tag('div', item.filename, class: 'dmsf_filename', title: l(:title_filename_for_download))
else
h(value)
end
when :size
number_to_human_size(value)
else
super column, item, value
end
end
end
end
end
RedmineExtensions::PatchManager.register_helper_patch 'QueriesHelper',
'RedmineDmsf::Patches::QueriesHelperPatch', prepend: true