#1080 New view
This commit is contained in:
parent
42fdf27303
commit
67e2fe9561
1
Gemfile
1
Gemfile
@ -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__)) }
|
||||
|
||||
@ -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
|
||||
|
||||
29
app/models/dmsf_author_query_column.rb
Normal file
29
app/models/dmsf_author_query_column.rb
Normal 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
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
29
app/models/dmsf_modified_query_column.rb
Normal file
29
app/models/dmsf_modified_query_column.rb
Normal 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
238
app/models/dmsf_query.rb
Normal 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
|
||||
29
app/models/dmsf_title_query_column.rb
Normal file
29
app/models/dmsf_title_query_column.rb
Normal 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
|
||||
29
app/models/dmsf_version_query_column.rb
Normal file
29
app/models/dmsf_version_query_column.rb
Normal 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
|
||||
@ -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 %>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
@ -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) %>
|
||||
|
||||
@ -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) %>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
57
app/views/dmsf/_query_list.html.erb
Normal file
57
app/views/dmsf/_query_list.html.erb
Normal 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 %>
|
||||
@ -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 %>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
@ -90,165 +90,172 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 %>
|
||||
<%= hidden_field_tag('action') %>
|
||||
<% unless @system_folder %>
|
||||
<div id="dmsf_buttons" class="dmsf_controls">
|
||||
<%= submit_tag(l(:button_download), title: l(:title_download_checked), name: 'download_entries',
|
||||
class: 'toggle-selection', data: { disable_with: false }) if @file_view_allowed %>
|
||||
<%= submit_tag(l(:field_mail), title: l(:title_send_checked_by_email), name: 'email_entries', class: 'toggle-selection',
|
||||
data: { disable_with: false }) if (@file_view_allowed && User.current.allowed_to?(:email_documents, @project)) %>
|
||||
<% if @file_delete_allowed %>
|
||||
<%= submit_tag(l(:button_delete), title: l(:title_delete_checked), name: 'delete_entries', class: 'toggle-selection',
|
||||
data: { confirm: l(:text_are_you_sure), disable_with: false }) if @file_delete_allowed %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @query %>
|
||||
<%= form_tag(dmsf_path(@project, @folder), method: :get, id: 'query_form') do %>
|
||||
<%= render partial: 'queries/query_form' %>
|
||||
<% end %>
|
||||
<% unless @system_folder %>
|
||||
<% values = @folder ? @folder.custom_field_values : DmsfFolder.new.custom_field_values %>
|
||||
<% unless values.empty? %>
|
||||
<% values.sort! { |a, b| a.custom_field.position <=> b.custom_field.position } %>
|
||||
<% custom_value = values.first %>
|
||||
<% if custom_value.custom_field.format.is_a?(Redmine::FieldFormat::ListFormat) %>
|
||||
<div id="dmsf_tag" class="dmsf_controls">
|
||||
<% custom_value.custom_field.is_required = false %>
|
||||
<% custom_value.value = params[:custom_value].present? ? params[:custom_value] : '' %>
|
||||
<%= h(custom_value.custom_field.name) %>:
|
||||
<%= custom_value.custom_field.format.edit_tag(self,
|
||||
custom_field_tag_id(:dmsf_folder, custom_value.custom_field),
|
||||
custom_field_tag_name(:dmsf_folder, custom_value.custom_field),
|
||||
custom_value,
|
||||
:class => "#{custom_value.custom_field.field_format}_cf",
|
||||
:style => 'width: auto') %>
|
||||
</div>
|
||||
<%= 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 %>
|
||||
<%= hidden_field_tag('action') %>
|
||||
<% unless @system_folder %>
|
||||
<div id="dmsf_buttons" class="dmsf_controls">
|
||||
<%= submit_tag(l(:button_download), title: l(:title_download_checked), name: 'download_entries',
|
||||
class: 'toggle-selection', data: { disable_with: false }) if @file_view_allowed %>
|
||||
<%= submit_tag(l(:field_mail), title: l(:title_send_checked_by_email), name: 'email_entries', class: 'toggle-selection',
|
||||
data: { disable_with: false }) if (@file_view_allowed && User.current.allowed_to?(:email_documents, @project)) %>
|
||||
<% if @file_delete_allowed %>
|
||||
<%= submit_tag(l(:button_delete), title: l(:title_delete_checked), name: 'delete_entries', class: 'toggle-selection',
|
||||
data: { confirm: l(:text_are_you_sure), disable_with: false }) if @file_delete_allowed %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @system_folder %>
|
||||
<% values = @folder ? @folder.custom_field_values : DmsfFolder.new.custom_field_values %>
|
||||
<% unless values.empty? %>
|
||||
<% values.sort! { |a, b| a.custom_field.position <=> b.custom_field.position } %>
|
||||
<% custom_value = values.first %>
|
||||
<% if custom_value.custom_field.format.is_a?(Redmine::FieldFormat::ListFormat) %>
|
||||
<div id="dmsf_tag" class="dmsf_controls">
|
||||
<% custom_value.custom_field.is_required = false %>
|
||||
<% custom_value.value = params[:custom_value].present? ? params[:custom_value] : '' %>
|
||||
<%= h(custom_value.custom_field.name) %>:
|
||||
<%= custom_value.custom_field.format.edit_tag(self,
|
||||
custom_field_tag_id(:dmsf_folder, custom_value.custom_field),
|
||||
custom_field_tag_name(:dmsf_folder, custom_value.custom_field),
|
||||
custom_value,
|
||||
:class => "#{custom_value.custom_field.field_format}_cf",
|
||||
:style => 'width: auto') %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @tree_view %>
|
||||
<%= render(:partial => 'tree_view') %>
|
||||
<% else %>
|
||||
<%= render(:partial => 'list_view') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= context_menu %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'jquery.dataTables/datatables.min.css', :plugin => :redmine_dmsf %>
|
||||
<%= javascript_include_tag 'jquery.dataTables/datatables.min.js', :plugin => :redmine_dmsf, defer: true %>
|
||||
|
||||
<% 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') %>
|
||||
<% clear_title = DmsfFolder.get_column_position('clear_title') %>
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
$("#browser").dataTable({
|
||||
orderClasses: false,
|
||||
responsive: {
|
||||
details: false
|
||||
},
|
||||
language: {
|
||||
url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>"
|
||||
},
|
||||
oLanguage: {
|
||||
sSearch: "<%= l(:description_filter) %>:"
|
||||
},
|
||||
autoWidth: false,
|
||||
paginate: false,
|
||||
<% if title %>
|
||||
order: [[<%= title %>, "asc"]],
|
||||
<% end %>
|
||||
sortingFixed: [[ <%= position %>, "asc"]],
|
||||
columnDefs: [
|
||||
{ responsivePriority: 1, targets: <%= title %> },
|
||||
{ responsivePriority: 2, targets: <%= commands %> },
|
||||
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>, <%= clear_title %>] },
|
||||
{ sortable: false, targets: [0, <%= commands %>] }
|
||||
<% if title %>
|
||||
,{ iDataSort: <%= clear_title %>, targets: [ <%= title %> ] }
|
||||
<% end %>
|
||||
<% if size %>
|
||||
,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] }
|
||||
<% end %>
|
||||
<% if modified %>
|
||||
,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] }
|
||||
<% end %>
|
||||
<% if version %>
|
||||
,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] }
|
||||
<% end %>
|
||||
],
|
||||
"fnInitComplete": function() {
|
||||
var browserFilter = $("#browser_filter");
|
||||
$("#dmsf_buttons").insertBefore(browserFilter);
|
||||
$("#dmsf_tag").insertBefore(browserFilter);
|
||||
$("#dmsf_ajax_loading").hide();
|
||||
$("#browser").show();
|
||||
$("#dmsf_buttons").show();
|
||||
$("#dmsf_tag").show();
|
||||
$("#dmsf_uploader").show();
|
||||
$("#dmsf_uploader_header").show();
|
||||
},
|
||||
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
|
||||
<% folder_id = @folder ? @folder.id : nil %>
|
||||
return "<%= "#{l(:label_number_of_folders)}: #{DmsfFolder.visible.where(project_id: @project.id, dmsf_folder_id: folder_id).all.size + DmsfLink.visible.where(project_id: @project.id, dmsf_folder_id: folder_id, target_type: 'DmsfFolder').all.size}, #{l(:label_number_of_documents)}: #{DmsfFile.visible.where(project_id: @project.id, dmsf_folder_id: folder_id).all.size + DmsfLink.visible.where(project_id: @project.id, dmsf_folder_id: folder_id, target_type: %w(DmsfFile DmsfUrl)).all.size}" %>";
|
||||
}
|
||||
});
|
||||
|
||||
$("[data-downloadurl]").each(function() {
|
||||
var url = this.getAttribute("data-downloadurl");
|
||||
if (this.addEventListener) {
|
||||
this.addEventListener("dragstart", function(e) {
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.setData("DownloadURL", url);
|
||||
}
|
||||
},false);
|
||||
}
|
||||
});
|
||||
|
||||
var entriesForm = $('#entries_form');
|
||||
|
||||
entriesForm.submit(function () {
|
||||
$(this).removeAttr("data-submitted");
|
||||
});
|
||||
|
||||
$('.list_cf').change(function() {
|
||||
entriesForm.attr('action', "<%= tag_changed_path(:id => @project, :folder_id => @folder) %>");
|
||||
entriesForm.submit();
|
||||
});
|
||||
<% if @tree_view %>
|
||||
<%= render(:partial => 'tree_view') %>
|
||||
<% else %>
|
||||
<%= render(:partial => 'list_view') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @file_manipulation_allowed && !@locked_for_user && !@system_folder %>
|
||||
<%= render(:partial => 'dmsf_upload/multi_upload', local: { rlf: @rlf }) %>
|
||||
<% end %>
|
||||
<%= context_menu %>
|
||||
|
||||
<% unless @system_folder %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'jquery.dataTables/datatables.min.css', :plugin => :redmine_dmsf %>
|
||||
<%= javascript_include_tag 'jquery.dataTables/datatables.min.js', :plugin => :redmine_dmsf, defer: true %>
|
||||
|
||||
<% 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') %>
|
||||
<% clear_title = DmsfFolder.get_column_position('clear_title') %>
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
$("#browser").dataTable({
|
||||
orderClasses: false,
|
||||
responsive: {
|
||||
details: false
|
||||
},
|
||||
language: {
|
||||
url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>"
|
||||
},
|
||||
oLanguage: {
|
||||
sSearch: "<%= l(:description_filter) %>:"
|
||||
},
|
||||
autoWidth: false,
|
||||
paginate: false,
|
||||
<% if title %>
|
||||
order: [[<%= title %>, "asc"]],
|
||||
<% end %>
|
||||
sortingFixed: [[ <%= position %>, "asc"]],
|
||||
columnDefs: [
|
||||
{ responsivePriority: 1, targets: <%= title %> },
|
||||
{ responsivePriority: 2, targets: <%= commands %> },
|
||||
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>, <%= clear_title %>] },
|
||||
{ sortable: false, targets: [0, <%= commands %>] }
|
||||
<% if title %>
|
||||
,{ iDataSort: <%= clear_title %>, targets: [ <%= title %> ] }
|
||||
<% end %>
|
||||
<% if size %>
|
||||
,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] }
|
||||
<% end %>
|
||||
<% if modified %>
|
||||
,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] }
|
||||
<% end %>
|
||||
<% if version %>
|
||||
,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] }
|
||||
<% end %>
|
||||
],
|
||||
"fnInitComplete": function() {
|
||||
var browserFilter = $("#browser_filter");
|
||||
$("#dmsf_buttons").insertBefore(browserFilter);
|
||||
$("#dmsf_tag").insertBefore(browserFilter);
|
||||
$("#dmsf_ajax_loading").hide();
|
||||
$("#browser").show();
|
||||
$("#dmsf_buttons").show();
|
||||
$("#dmsf_tag").show();
|
||||
$("#dmsf_uploader").show();
|
||||
$("#dmsf_uploader_header").show();
|
||||
},
|
||||
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
|
||||
<% folder_id = @folder ? @folder.id : nil %>
|
||||
return "<%= "#{l(:label_number_of_folders)}: #{DmsfFolder.visible.where(project_id: @project.id, dmsf_folder_id: folder_id).all.size + DmsfLink.visible.where(project_id: @project.id, dmsf_folder_id: folder_id, target_type: 'DmsfFolder').all.size}, #{l(:label_number_of_documents)}: #{DmsfFile.visible.where(project_id: @project.id, dmsf_folder_id: folder_id).all.size + DmsfLink.visible.where(project_id: @project.id, dmsf_folder_id: folder_id, target_type: %w(DmsfFile DmsfUrl)).all.size}" %>";
|
||||
}
|
||||
});
|
||||
|
||||
$("[data-downloadurl]").each(function() {
|
||||
var url = this.getAttribute("data-downloadurl");
|
||||
if (this.addEventListener) {
|
||||
this.addEventListener("dragstart", function(e) {
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.setData("DownloadURL", url);
|
||||
}
|
||||
},false);
|
||||
}
|
||||
});
|
||||
|
||||
var entriesForm = $('#entries_form');
|
||||
|
||||
entriesForm.submit(function () {
|
||||
$(this).removeAttr("data-submitted");
|
||||
});
|
||||
|
||||
$('.list_cf').change(function() {
|
||||
entriesForm.attr('action', "<%= tag_changed_path(:id => @project, :folder_id => @folder) %>");
|
||||
entriesForm.submit();
|
||||
});
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @file_manipulation_allowed && !@locked_for_user && !@system_folder %>
|
||||
<%= render(:partial => 'dmsf_upload/multi_upload', local: { rlf: @rlf }) %>
|
||||
<% end %>
|
||||
<% 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>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
@ -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| %>
|
||||
|
||||
@ -413,4 +413,8 @@ div.dmsf_revision_inner_box .attribute .label {
|
||||
|
||||
.dmsf_attachments_label{
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
#dmsf_csv_export_options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -165,8 +165,10 @@ if Redmine::Plugin.installed? :redmine_dmsf
|
||||
end
|
||||
end
|
||||
|
||||
# WebDAV
|
||||
match '/', to: lambda { |env| [405, {}, [env.to_s]] }, via: [:propfind, :options]
|
||||
# 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
|
||||
|
||||
@ -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'
|
||||
|
||||
52
lib/redmine_dmsf/patches/queries_helper_patch.rb
Normal file
52
lib/redmine_dmsf/patches/queries_helper_patch.rb
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user