Removal of unnnecessary files

This commit is contained in:
Karel Pičman 2025-07-03 15:58:43 +02:00
parent 1d5a89b65b
commit fac307354d
71 changed files with 258 additions and 1121 deletions

View File

@ -84,7 +84,7 @@ Naming/AccessorMethodName:
Naming/PredicateName: Naming/PredicateName:
Exclude: Exclude:
- patches/attachable_patch.rb # Easy tests - patches/attachable_patch.rb
Style/HashSyntax: Style/HashSyntax:
EnforcedShorthandSyntax: either EnforcedShorthandSyntax: either
@ -95,7 +95,7 @@ Style/ZeroLengthPredicate:
Rails/BulkChangeTable: Rails/BulkChangeTable:
Exclude: Exclude:
- db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb # Easy tests - db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb
Rails/DangerousColumnNames: Rails/DangerousColumnNames:
Exclude: Exclude:
@ -123,8 +123,8 @@ Rails/SkipsModelValidations:
Rails/ThreeStateBooleanColumn: Rails/ThreeStateBooleanColumn:
Exclude: Exclude:
- db/migrate/04_dmsf_0_9_0.rb # Easy tests - db/migrate/04_dmsf_0_9_0.rb
- db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb # Easy tests - db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb
Rails/UniqueValidationWithoutIndex: Rails/UniqueValidationWithoutIndex:
Exclude: Exclude:

12
Gemfile
View File

@ -24,14 +24,12 @@ source 'https://rubygems.org' do
gem 'zip-zip' unless Dir.exist?(File.expand_path('../../vault', __FILE__)) gem 'zip-zip' unless Dir.exist?(File.expand_path('../../vault', __FILE__))
# Redmine extensions # Redmine extensions
unless Dir.exist?(File.expand_path('../../easyproject', __FILE__)) gem 'active_record_union'
gem 'active_record_union' gem 'simple_enum'
gem 'simple_enum' group :xapian do
group :xapian do gem 'xapian-ruby'
gem 'xapian-ruby'
end
end end
unless %w[easyproject easy_gantt custom_tables] unless %w[easy_gantt custom_tables]
.any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) } .any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) }
group :test do group :test do
gem 'rails-controller-testing' gem 'rails-controller-testing'

View File

@ -1,155 +0,0 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Vít Jonáš <vit.jonas@gmail.com>, Daniel Munn <dan.munn@munnster.co.uk>, Karel Pičman <karel.picman@kontron.com>
#
# This file is part of Redmine DMSF plugin.
#
# Redmine DMSF plugin 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 3 of the License, or (at your option) any
# later version.
#
# Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see
# <https://www.gnu.org/licenses/>.
require 'redmine'
require 'zip'
require "#{File.dirname(__FILE__)}/lib/redmine_dmsf"
def dmsf_init
# Administration menu extension
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :dmsf_approvalworkflows, :dmsf_workflows_path,
caption: :label_dmsf_workflow_plural,
icon: 'workflows',
html: { class: 'icon icon-workflows' },
if: proc { |_| User.current.admin? }
end
# Project menu extension
Redmine::MenuManager.map :project_menu do |menu|
menu.push :dmsf, { controller: 'dmsf', action: 'show' },
caption: :menu_dmsf,
before: :documents,
param: :id,
html: { class: 'icon icon-dmsf' }
# New menu extension
next if defined?(EasyExtensions)
menu.push :dmsf_file, { controller: 'dmsf_upload', action: 'multi_upload' },
caption: :label_dmsf_new_top_level_document, parent: :new_object
menu.push :dmsf_folder, { controller: 'dmsf', action: 'new' },
caption: :label_dmsf_new_top_level_folder,
parent: :new_object
end
# Main menu extension
Redmine::MenuManager.map :top_menu do |menu|
menu.push :dmsf, { controller: 'dmsf', action: 'index' },
caption: :menu_dmsf,
html: { class: 'icon-dmsf', category: :rest_extension_modules },
if: proc {
User.current.allowed_to?(:view_dmsf_folders, nil, global: true) &&
ActiveRecord::Base.connection.data_source_exists?('settings') &&
!RedmineDmsf.dmsf_global_menu_disabled?
}
end
Redmine::AccessControl.map do |map|
map.project_module :dmsf do |pmap|
pmap.permission :view_dmsf_file_revision_accesses, {}, read: true
pmap.permission :view_dmsf_file_revisions, {}, read: true
pmap.permission :view_dmsf_folders, { dmsf: %i[show index] }, read: true
pmap.permission :user_preferences, { dmsf_state: [:user_pref_save] }, require: :member
pmap.permission(:view_dmsf_files,
{ dmsf: %i[entries_operation entries_email download_email_entries add_email append_email
autocomplete_for_user],
dmsf_files: %i[show view thumbnail],
dmsf_workflows: [:log] },
read: true)
pmap.permission :email_documents,
{ dmsf_public_urls: [:create] }
pmap.permission :folder_manipulation,
{ dmsf: %i[new create delete edit save edit_root save_root lock unlock notify_activate
notify_deactivate restore drop copymove],
dmsf_folder_permissions: %i[new append autocomplete_for_user],
dmsf_context_menus: [:dmsf] }
pmap.permission :file_manipulation,
{ dmsf_files: %i[create_revision lock unlock delete_revision obsolete_revision
notify_activate notify_deactivate restore],
dmsf_upload: %i[upload_files upload commit_files commit delete_dmsf_attachment
delete_dmsf_link_attachment multi_upload],
dmsf_links: %i[new create destroy restore autocomplete_for_project autocomplete_for_folder],
dmsf_context_menus: [:dmsf] }
pmap.permission :file_delete,
{ dmsf: %i[trash delete_entries empty_trash],
dmsf_files: [:delete],
dmsf_trash_context_menus: [:trash] }
pmap.permission :force_file_unlock, {}
pmap.permission :file_approval,
{ dmsf_workflows: %i[action new_action autocomplete_for_user start assign assignment] }
pmap.permission :manage_workflows,
{ dmsf_workflows: %i[index new create destroy show new_step add_step remove_step
reorder_steps update update_step delete_step edit] }
pmap.permission :display_system_folders, {}, read: true
# Watchers
pmap.permission :view_dmsf_file_watchers, {}, read: true
pmap.permission :add_dmsf_file_watchers, { watchers: %i[new create append autocomplete_for_user] }
pmap.permission :delete_dmsf_file_watchers, { watchers: :destroy }
pmap.permission :view_dmsf_folder_watchers, {}, read: true
pmap.permission :add_dmsf_folder_watchers, { watchers: %i[new create append autocomplete_for_user] }
pmap.permission :delete_dmsf_folder_watchers, { watchers: :destroy }
pmap.permission :view_project_watchers, {}, read: true
pmap.permission :add_project_watchers, { watchers: %i[new create append autocomplete_for_user] }
pmap.permission :delete_project_watchers, { watchers: :destroy }
end
end
# DMSF WebDAV digest token
Token.add_action :dmsf_webdav_digest, max_instances: 1, validity_time: nil
end
if defined?(EasyExtensions)
Rails.application.config.after_initialize do
dmsf_init
# Register panels for My page
EpmDmsfLockedDocuments.register_to_scope :user, plugin: :redmine_dmsf
EpmDmsfOpenApprovals.register_to_scope :user, plugin: :redmine_dmsf
EpmDmsfWatchedDocuments.register_to_scope :user, plugin: :redmine_dmsf
end
else
dmsf_init
end
Rails.application.configure do
# Rubyzip configuration
Zip.unicode_names = true
# DMS custom fields
after_easy_init do
CustomFieldsHelper::CUSTOM_FIELDS_TABS << { name: 'DmsfFileRevisionCustomField', partial: 'custom_fields/index',
label: :dmsf }
end
# Searchable modules
after_easy_init do
Redmine::Search.map do |search|
search.register :dmsf_files
search.register :dmsf_folders
end
end
# Activities
after_easy_init do
Redmine::Activity.register :dmsf_file_revision_accesses, default: false
Redmine::Activity.register :dmsf_file_revisions
end
if defined?(EasyExtensions)
require "#{File.dirname(__FILE__)}/lib/redmine_dmsf/webdav/custom_middleware"
config.middleware.insert_before ActionDispatch::Cookies, RedmineDmsf::Webdav::CustomMiddleware
end
end

View File

@ -759,11 +759,7 @@ class DmsfController < ApplicationController
def query def query
retrieve_default_query true retrieve_default_query true
@query = if defined?(EasyExtensions) @query = retrieve_query DmsfQuery, true
retrieve_query_without_easy_extensions DmsfQuery, true
else
retrieve_query DmsfQuery, true
end
end end
def retrieve_default_query(use_session) def retrieve_default_query(use_session)

View File

@ -75,7 +75,6 @@ class DmsfUploadController < ApplicationController
@attachment.author = User.current @attachment.author = User.current
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16) @attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
@attachment.content_type = params[:content_type].presence @attachment.content_type = params[:content_type].presence
@attachment.skip_description_required = true if defined?(EasyExtensions)
begin begin
Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible, raise: false) Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible, raise: false)
saved = @attachment.save saved = @attachment.save

View File

@ -24,14 +24,6 @@ require 'csv'
module DmsfHelper module DmsfHelper
include Redmine::I18n include Redmine::I18n
unless defined?(EasyExtensions)
def late_javascript_tag(content_or_options_with_block = nil, html_options = {}, &block)
javascript_tag content_or_options_with_block, html_options, &block
end
end
def self.temp_filename(filename) def self.temp_filename(filename)
filename = sanitize_filename(filename) filename = sanitize_filename(filename)
timestamp = DateTime.current.strftime('%y%m%d%H%M%S') timestamp = DateTime.current.strftime('%y%m%d%H%M%S')

View File

@ -98,10 +98,6 @@ module DmsfUploadHelper
end end
FileUtils.mv committed_file[:tempfile_path], new_revision.disk_file(search_if_not_exists: false) FileUtils.mv committed_file[:tempfile_path], new_revision.disk_file(search_if_not_exists: false)
FileUtils.chmod 'u=wr,g=r', new_revision.disk_file(search_if_not_exists: false) FileUtils.chmod 'u=wr,g=r', new_revision.disk_file(search_if_not_exists: false)
if defined?(EasyExtensions)
# We need to trigger Xapian indexing after the file is moved to its target destination
file.touch
end
file.last_revision = new_revision file.last_revision = new_revision
files.push file files.push file
container.dmsf_file_added file if container && !new_object container.dmsf_file_added file if container && !new_object

View File

@ -628,66 +628,11 @@ class DmsfFile < ApplicationRecord
id = Regexp.last_match(1).to_i id = Regexp.last_match(1).to_i
case dmsf_folder.dmsf_folder&.title case dmsf_folder.dmsf_folder&.title
when '.CRM cases'
EasyCrmCase.visible.find_by id: id
when '.Issues' when '.Issues'
Issue.visible.find_by id: id Issue.visible.find_by id: id
end end
end end
if defined?(EasyExtensions)
include Redmine::Utils::Shell
def sheet?
case File.extname(last_revision&.disk_filename)
when '.ods', # LibreOffice
'.xls', '.xlsx', '.xlsm' # MS Office
true
else
false
end
end
def content
if File.exist?(last_revision.disk_file)
if File.size?(last_revision.disk_file) < 5.megabytes
tmp = Rails.root.join('tmp')
if sheet?
cmd = "#{shell_quote(RedmineDmsf::Preview::OFFICE_BIN)} --convert-to 'csv' \
--outdir #{shell_quote(tmp.to_s)} #{shell_quote(last_revision.disk_file)}"
text_file = tmp.join(last_revision.disk_filename).sub_ext('.csv')
elsif office_doc?
cmd = "#{shell_quote(RedmineDmsf::Preview::OFFICE_BIN)} --convert-to 'txt:Text (encoded):UTF8' \
--outdir #{shell_quote(tmp.to_s)} #{shell_quote(last_revision.disk_file)}"
text_file = tmp.join(last_revision.disk_filename).sub_ext('.txt')
elsif pdf?
text_file = tmp.join(last_revision.disk_filename).sub_ext('.txt')
cmd = "pdftotext -q #{shell_quote(last_revision.disk_file)} #{shell_quote(text_file.to_s)}"
elsif text?
return File.read(last_revision.disk_file)
end
if cmd
if system(cmd) && File.exist?(text_file)
text = File.read(text_file)
FileUtils.rm_f text_file
return text
else
Rails.logger.error "Conversion to text failed (#{$CHILD_STATUS}):\nCommand: #{cmd}"
end
end
else
Rails.logger.warn "File #{last_revision.disk_file} is to big to be indexed (>5MB)"
end
end
description
rescue StandardError => e
Rails.logger.warn e.message
''
ensure
FileUtils.rm_f(text_file) if text_file.present?
end
end
def to_s def to_s
name name
end end

View File

@ -118,10 +118,6 @@ class DmsfFileRevision < ApplicationRecord
remove_extension(filename).gsub(/_+/, ' ') remove_extension(filename).gsub(/_+/, ' ')
end end
def self.easy_activity_custom_project_scope(scope, options, _)
scope.where(dmsf_files: { project_id: options[:project_ids] })
end
def delete(commit: false, force: true) def delete(commit: false, force: true)
if dmsf_file.locked_for_user? if dmsf_file.locked_for_user?
errors.add :base, l(:error_file_is_locked) errors.add :base, l(:error_file_is_locked)

View File

@ -117,11 +117,7 @@ class DmsfFolder < ApplicationRecord
if folder&.system if folder&.system
return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project) return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project)
if ['.Issues', '.CRM cases'].exclude?(folder.title) && return false if (folder.title != '.Issues') && !folder.issue&.visible?(User.current)
!folder.issue&.visible?(User.current) &&
!folder.easy_crm_case&.visible?(User.current)
return false
end
end end
# Permissions to the folder? # Permissions to the folder?
if folder.dmsf_folder_permissions.any? if folder.dmsf_folder_permissions.any?
@ -477,19 +473,6 @@ class DmsfFolder < ApplicationRecord
@issue @issue
end end
def easy_crm_case
if @easy_crm_case.nil? && system
case_id = title.to_i
begin
ecc = 'EasyCrmCase'.constantize
rescue NameError => _e
ecc = nil
end
@easy_crm_case = EasyCrmCase.find_by(id: case_id) if ecc && case_id.positive?
end
@easy_crm_case
end
def update_from_params(params) def update_from_params(params)
# Attributes # Attributes
self.title = params[:dmsf_folder][:title].scrub.strip self.title = params[:dmsf_folder][:title].scrub.strip

View File

@ -22,7 +22,7 @@
<%= form_tag(append_email_dmsf_path(id: @project), remote: true, method: :post, id: 'new-user-form') do %> <%= form_tag(append_email_dmsf_path(id: @project), remote: true, method: :post, id: 'new-user-form') do %>
<%= hidden_field_tag :project_id, @project.id %> <%= hidden_field_tag :project_id, @project.id %>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> <p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for( <%= javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
controller: 'dmsf', action: 'autocomplete_for_user') }')" %> controller: 'dmsf', action: 'autocomplete_for_user') }')" %>
<div id="users_for_watcher"> <div id="users_for_watcher">
<%= render_principals_for_new_email @principals %> <%= render_principals_for_new_email @principals %>

View File

@ -31,7 +31,7 @@
class: 'icon icon-add', data: { cy: 'button__create-folder--dmsf' } %> class: 'icon icon-add', data: { cy: 'button__create-folder--dmsf' } %>
<% end %> <% end %>
<% end %> <% end %>
<% if defined?(EasyExtensions) %> <%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/main', locals: { <%= render partial: 'dmsf_context_menus/main', locals: {
folder_manipulation_allowed: @folder_manipulation_allowed, folder_manipulation_allowed: @folder_manipulation_allowed,
system_folder: @system_folder, system_folder: @system_folder,
@ -40,19 +40,7 @@
locked: @locked, locked: @locked,
file_manipulation_allowed: @file_manipulation_allowed, file_manipulation_allowed: @file_manipulation_allowed,
trash_enabled: @trash_enabled, trash_enabled: @trash_enabled,
notifications: @notifications } %> notifications: @notifications} %>
<% else %>
<%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/main', locals: {
folder_manipulation_allowed: @folder_manipulation_allowed,
system_folder: @system_folder,
folder: @folder,
project: @project,
locked: @locked,
file_manipulation_allowed: @file_manipulation_allowed,
trash_enabled: @trash_enabled,
notifications: @notifications} %>
<% end %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
@ -103,24 +91,6 @@
<% end %> <% end %>
<% end %> <% end %>
<% if defined?(EasyExtensions) %> <% javascript_tag do %>
<%= late_javascript_tag do %>
$(function() {
$("p.buttons").addClass("filter-buttons form-actions");
let buttonApply = $("p.filter-buttons > a.icon-checked");
buttonApply.addClass("button-positive");
buttonApply.text("<%= l('easy_query.button_apply.issue') %>");
let buttonClear = $("p.filter-buttons > a.icon-reload");
buttonClear.addClass("button-negative");
buttonClear.text("<%= l('easy_query.label.default_filters') %>");
$("p.filter-buttons > a.icon-save").addClass("button");
$("p.filter-buttons > a.icon-edit").addClass("button");
$("p.filter-buttons > a.icon-del").addClass("button");
$("#query_form_with_buttons > p.buttons").show();
});
<% end %>
<% end %>
<% late_javascript_tag do %>
"$('#ajax-indicator').hide();" "$('#ajax-indicator').hide();"
<% end %> <% end %>

View File

@ -27,15 +27,9 @@
<table class="list dmsf odd-even <%= query.css_classes %> context-menu-container" data-hascontextmenu="true"> <table class="list dmsf odd-even <%= query.css_classes %> context-menu-container" data-hascontextmenu="true">
<thead> <thead>
<tr> <tr>
<% if defined?(EasyExtensions) %> <th class="checkbox hide-when-print">
<%# Easy checkbox %> <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
<%= content_tag :th, link_to_function('', 'EASY.contextMenu.toggleIssuesSelection($(this))', </th>
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}", class: 'icon icon-checked') %>
<% else %>
<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>
<% end %>
<% query.inline_columns.each do |column| %> <% query.inline_columns.each do |column| %>
<%= column_header(query, column, query_options) %> <%= column_header(query, column, query_options) %>
<% end %> <% end %>

View File

@ -46,20 +46,14 @@
<% end %> <% end %>
<td class="buttons"> <td class="buttons">
<% unless node.system %> <% unless node.system %>
<% if defined?(EasyExtensions) %> <%= link_to_context_menu %>
<%= link_to '', '#', title: l(:button_actions),
class: 'icon-only icon-actions js-contextmenu icon-more-horiz',
data: { cy: "icon__more_horiz--#{node.type}_#{node.id}" } %>
<% else %>
<%= link_to_context_menu %>
<% end %>
<% end %> <% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% unless query.deleted || query&.project.nil? %> <% unless query.deleted || query&.project.nil? %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$(function() { $(function() {
$("table.dmsf tr").removeClass("ui-draggable-dragging ui-droppable-active ui-droppable-hover ui-draggable-handle"); $("table.dmsf tr").removeClass("ui-draggable-dragging ui-droppable-active ui-droppable-hover ui-draggable-handle");
$(".dmsf-draggable").draggable({ $(".dmsf-draggable").draggable({

View File

@ -56,7 +56,7 @@
<% end %> <% end %>
<% end %> <% end %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#move_button').click(function(event) { $('#move_button').click(function(event) {
$('input#copy_entries').remove() $('input#copy_entries').remove()
}); });

View File

@ -33,7 +33,7 @@
back_url: edit_dmsf_url(id: @project, folder_id: @folder)), back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
title: l(:title_lock_file), class: 'icon icon-lock' %> title: l(:title_lock_file), class: 'icon icon-lock' %>
<% end %> <% end %>
<% if defined?(EasyExtensions) %> <%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/folder', <%= render partial: 'dmsf_context_menus/folder',
locals: { dmsf_folder: @folder, locals: { dmsf_folder: @folder,
locked: @folder.locked?, locked: @folder.locked?,
@ -47,22 +47,6 @@
notifications: @notifications, notifications: @notifications,
back_url: edit_dmsf_url(id: @project, folder_id: @folder) back_url: edit_dmsf_url(id: @project, folder_id: @folder)
} %> } %>
<% else %>
<%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/folder',
locals: { dmsf_folder: @folder,
locked: @folder.locked?,
allowed: true,
dmsf_link: nil,
project: @project,
folder: @folder.dmsf_folder,
edit: true,
unlockable: @folder.unlockable? && (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)),
email_allowed: User.current.allowed_to?(:email_documents, @project),
notifications: @notifications,
back_url: edit_dmsf_url(id: @project, folder_id: @folder)
} %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@ -40,21 +40,3 @@
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render partial: 'dmsf/sidebar' %> <%= render partial: 'dmsf/sidebar' %>
<% end %> <% end %>
<% if defined?(EasyExtensions) %>
<%= late_javascript_tag do %>
$(function() {
$("p.buttons").addClass("filter-buttons form-actions");
let buttonApply = $("p.filter-buttons > a.icon-checked");
buttonApply.addClass("button-positive");
buttonApply.text("<%= l('easy_query.button_apply.issue') %>");
let buttonClear = $("p.filter-buttons > a.icon-reload");
buttonClear.addClass("button-negative");
buttonClear.text("<%= l('easy_query.label.default_filters') %>");
$("p.filter-buttons > a.icon-save").addClass("button");
$("p.filter-buttons > a.icon-edit").addClass("button");
$("p.filter-buttons > a.icon-del").addClass("button");
$("#query_form_with_buttons > p.buttons").show();
});
<% end %>
<% end %>

View File

@ -38,7 +38,7 @@
<% end %> <% end %>
</ul> </ul>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#dmsf-cm-delete').click(function (event) { $('#dmsf-cm-delete').click(function (event) {
$('#context-menu').hide(); $('#context-menu').hide();
}); });

View File

@ -31,7 +31,7 @@
allowed_restore: @allowed_restore }) %> allowed_restore: @allowed_restore }) %>
<% end %> <% end %>
</ul> </ul>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#dmsf-cm-delete').click(function (event) { $('#dmsf-cm-delete').click(function (event) {
$('#context-menu').hide(); $('#context-menu').hide();
}); });

View File

@ -37,16 +37,10 @@
lock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)), lock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)),
title: l(:title_lock_file), class: 'icon icon-lock' %> title: l(:title_lock_file), class: 'icon icon-lock' %>
<% end %> <% end %>
<% if defined?(EasyExtensions) %> <%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/revisions', <%= render partial: 'dmsf_context_menus/revisions',
locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed, locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed,
notifications: @notifications, back_url: dmsf_file_path(id: @file)} %> notifications: @notifications, back_url: dmsf_file_path(id: @file) } %>
<% else %>
<%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/revisions',
locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed,
notifications: @notifications, back_url: dmsf_file_path(id: @file) } %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
@ -72,16 +66,10 @@
<div class="dmsf-revision-box"> <div class="dmsf-revision-box">
<div class="dmsf-widget-header fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"> <div class="dmsf-widget-header fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix">
<div class="dmsf-controls contextual"> <div class="dmsf-controls contextual">
<% if defined?(EasyExtensions) %> <%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/revision_actions', <%= render partial: 'dmsf_context_menus/revision_actions',
locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed, locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed,
file_manipulation_allowed: @file_manipulation_allowed, revision: revision } %> file_manipulation_allowed: @file_manipulation_allowed, revision: revision } %>
<% else %>
<%= actions_dropdown do %>
<%= render partial: 'dmsf_context_menus/revision_actions',
locals: { project: @project, file: @file, file_delete_allowed: @file_delete_allowed,
file_manipulation_allowed: @file_manipulation_allowed, revision: revision } %>
<% end %>
<% end %> <% end %>
</div> </div>
<div class="dmsf-widget-header-text"> <div class="dmsf-widget-header-text">
@ -176,7 +164,7 @@
<% end %> <% end %>
<% end %> <% end %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('a.delete-revision').click(function(event) { $('a.delete-revision').click(function(event) {
if(!window.confirm('<%= l(:text_are_you_sure) %>')) { if(!window.confirm('<%= l(:text_are_you_sure) %>')) {
event.preventDefault(); event.preventDefault();

View File

@ -21,7 +21,7 @@
<%= form_tag(append_dmsf_folder_permissions_path, remote: true, method: :post, id: 'new-user-form') do %> <%= form_tag(append_dmsf_folder_permissions_path, remote: true, method: :post, id: 'new-user-form') do %>
<%= hidden_field_tag :project_id, @project.id %> <%= hidden_field_tag :project_id, @project.id %>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> <p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for( <%= javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
controller: 'dmsf_folder_permissions', action: 'autocomplete_for_user', project_id: @project, controller: 'dmsf_folder_permissions', action: 'autocomplete_for_user', project_id: @project,
dmsf_folder_id: @dmsf_folder) }')" %> dmsf_folder_id: @dmsf_folder) }')" %>
<div id="users_for_watcher"> <div id="users_for_watcher">

View File

@ -4,8 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Wiki formatting</title> <title>Wiki formatting</title>
<%= stylesheet_link_tag 'wiki_syntax.css' %> <%= stylesheet_link_tag 'wiki_syntax.css' %>
<% plugin = defined?(EasyExtensions) ? nil : :redmine_dmsf %> <%= stylesheet_link_tag 'dmsf_help.css', plugin: :redmine_dmsf %>
<%= stylesheet_link_tag 'dmsf_help.css', plugin: plugin %>
</head> </head>
<body> <body>

View File

@ -45,7 +45,7 @@
<%= select_tag 'dmsf_link[target_project_id]', <%= select_tag 'dmsf_link[target_project_id]',
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy,
selected: @dmsf_link.target_project) %> selected: @dmsf_link.target_project) %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#dmsf_link_target_project_id').change(function(){ $('#dmsf_link_target_project_id').change(function(){
$.ajax({ $.ajax({
url: '<%= escape_javascript autocomplete_for_project_dmsf_link_path(@project, format: 'js') %>', url: '<%= escape_javascript autocomplete_for_project_dmsf_link_path(@project, format: 'js') %>',
@ -71,7 +71,7 @@
<% if !@fast_links || (@type != 'link_to') %> <% if !@fast_links || (@type != 'link_to') %>
<%= select_tag 'dmsf_link[target_folder_id]', <%= select_tag 'dmsf_link[target_folder_id]',
folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project)) %> folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project)) %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#dmsf_link_target_folder_id').change(function(){ $('#dmsf_link_target_folder_id').change(function(){
$.ajax({ $.ajax({
url: '<%= escape_javascript autocomplete_for_folder_dmsf_link_path(@project, format: 'js') %>', url: '<%= escape_javascript autocomplete_for_folder_dmsf_link_path(@project, format: 'js') %>',
@ -109,7 +109,7 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$(document).ready(function(){ $(document).ready(function(){
<%# Select2 extension, TODO: in case of a modal window, select2 makes problems %> <%# Select2 extension, TODO: in case of a modal window, select2 makes problems %>
<% unless modal || @fast_links %> <% unless modal || @fast_links %>

View File

@ -32,4 +32,4 @@ var awf = false;
<% end %> <% end %>
<% end %> <% end %>
dmsfAddLink(linksSpan, linkId, linkName, title, project, awf, <%= !defined?(EasyExtensions) %>); dmsfAddLink(linksSpan, linkId, linkName, title, project, awf);

View File

@ -48,7 +48,7 @@
<% end %> <% end %>
<% end %> <% end %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
// When the user scrolls the page, execute scrollFunction // When the user scrolls the page, execute scrollFunction
window.onscroll = function() { window.onscroll = function() {
scrollFunction(); scrollFunction();

View File

@ -41,7 +41,7 @@
<div> <div>
<%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %><br> <%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %><br>
<%= text_field_tag 'user_search', nil %> <%= text_field_tag 'user_search', nil %>
<%= late_javascript_tag "observeSearchfield('user_search', null, '#{escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: params[:dmsf_workflow_step_assignment_id], dmsf_file_revision_id: params[:dmsf_file_revision_id])}')" %> <%= javascript_tag "observeSearchfield('user_search', null, '#{escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: params[:dmsf_workflow_step_assignment_id], dmsf_file_revision_id: params[:dmsf_file_revision_id])}')" %>
<div id="dmsf_users_for_delegate"> <div id="dmsf_users_for_delegate">
<%= render_principals_for_new_dmsf_workflow_users( <%= render_principals_for_new_dmsf_workflow_users(
@dmsf_workflow, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id]) %> @dmsf_workflow, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id]) %>

View File

@ -24,7 +24,7 @@
<fieldset class="box"> <fieldset class="box">
<legend><%= l(:label_dmsf_workflow_add_approver) %></legend> <legend><%= l(:label_dmsf_workflow_add_approver) %></legend>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> <p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= late_javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: nil, dmsf_file_revision_id: nil, project_id: @project ? @project.id : nil) }')" %> <%= javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: nil, dmsf_file_revision_id: nil, project_id: @project ? @project.id : nil) }')" %>
<div id="dmsf_users_for_delegate"> <div id="dmsf_users_for_delegate">
<%= render_principals_for_new_dmsf_workflow_users @dmsf_workflow %> <%= render_principals_for_new_dmsf_workflow_users @dmsf_workflow %>
</div> </div>

View File

@ -133,6 +133,6 @@
<% end %> <% end %>
</div> </div>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$(function() { $("table.steps tbody").positionedItems(); }); $(function() { $("table.steps tbody").positionedItems(); });
<% end %> <% end %>

View File

@ -45,7 +45,7 @@
</div> </div>
<% end %> <% end %>
<%= late_javascript_tag do %> <%= javascript_tag do %>
$('#dmsf_workflow_id').change(function () { $('#dmsf_workflow_id').change(function () {
$('#content').load("<%= @project ? url_for(action: 'new', project_id: @project.id) : url_for(action: 'new') %>", $('#new_dmsf_workflow').serialize()); $('#content').load("<%= @project ? url_for(action: 'new', project_id: @project.id) : url_for(action: 'new') %>", $('#new_dmsf_workflow').serialize());
}); });

View File

@ -27,40 +27,28 @@
'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where( 'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where(
['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)', ['dmsf_locks.entity_type = ? AND dmsf_locks.user_id = ? AND (dmsf_locks.expires_at IS NULL OR dmsf_locks.expires_at > ?)',
0, @user&.id, Time.current]) %> 0, @user&.id, Time.current]) %>
<% easy_extension = defined?(EasyExtensions) %>
<% unless easy_extension %>
<h3>
<%= l(:locked_documents)%> (<%= "#{folders.all.size} #{l(:label_number_of_folders).downcase}" %> / <%= "#{files.all.size} #{l(:label_number_of_documents).downcase}" %>)
</h3>
<% end %>
<% if folders.any? || files.any?%> <% if folders.any? || files.any?%>
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
<%= hidden_field_tag 'back_url', my_page_path, id: nil %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %>
<table class="list context-menu-container" data-hascontextmenu="true"> <table class="list context-menu-container" data-hascontextmenu="true">
<thead> <thead>
<tr> <tr>
<% unless easy_extension %> <th class="checkbox hide-when-print">
<th class="checkbox hide-when-print"> <%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> </th>
</th>
<% end %>
<th><%= l(:field_project) %></th> <th><%= l(:field_project) %></th>
<th><%= l(:label_document) %>/<%= l(:field_folder) %></th> <th><%= l(:label_document) %>/<%= l(:field_folder) %></th>
<th><%= l(:field_folder) %></th> <th><%= l(:field_folder) %></th>
<% unless easy_extension %> <th></th>
<th></th>
<% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% folders.each do |folder| %> <% folders.each do |folder| %>
<tr id="folder-<%= folder.id %>" class="hascontextmenu"> <tr id="folder-<%= folder.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<%= link_to_project folder.project %> <%= link_to_project folder.project %>
</td> </td>
@ -76,20 +64,16 @@
<%= link_to l(:link_documents), dmsf_folder_path(id: folder.project) %> <%= link_to l(:link_documents), dmsf_folder_path(id: folder.project) %>
<% end %> <% end %>
</td> </td>
<% unless easy_extension %> <td class="buttons">
<td class="buttons"> <%= link_to_context_menu %>
<%= link_to_context_menu %> </td>
</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
<% files.each do |file| %> <% files.each do |file| %>
<tr id="file-<%= file.id %>" class="hascontextmenu"> <tr id="file-<%= file.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<%= link_to_project file.project %> <%= link_to_project file.project %>
</td> </td>
@ -104,17 +88,15 @@
<%= link_to_if file.project, l(:link_documents), dmsf_folder_path(id: file.project) %> <%= link_to_if file.project, l(:link_documents), dmsf_folder_path(id: file.project) %>
<% end %> <% end %>
</td> </td>
<% unless easy_extension %> <td class="buttons">
<td class="buttons"> <%= link_to_context_menu %>
<%= link_to_context_menu %> </td>
</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> <% end %>
<%= context_menu unless easy_extension %> <%= context_menu %>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>

View File

@ -30,40 +30,31 @@
order('dmsf_workflow_step_assignments.dmsf_file_revision_id, dmsf_workflow_steps.step').to_a %> order('dmsf_workflow_step_assignments.dmsf_file_revision_id, dmsf_workflow_steps.step').to_a %>
<% assignments = all_assignments.delete_if { |a| (a.dmsf_file_revision != a.dmsf_file_revision.dmsf_file.last_revision) } %> <% assignments = all_assignments.delete_if { |a| (a.dmsf_file_revision != a.dmsf_file_revision.dmsf_file.last_revision) } %>
<% assignments.uniq! { |a| a.dmsf_file_revision } %> <% assignments.uniq! { |a| a.dmsf_file_revision } %>
<% easy_extension = defined?(EasyExtensions) %> <h3><%= l(:open_approvals)%> (<%= assignments.size %>)</h3>
<% unless easy_extension %>
<h3><%= l(:open_approvals)%> (<%= assignments.size %>)</h3>
<% end %>
<% if assignments.any? %> <% if assignments.any? %>
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
<%= hidden_field_tag 'back_url', my_page_path, id: nil %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %>
<table class="list"> <table class="list">
<thead> <thead>
<tr> <tr>
<% unless easy_extension %> <th class="checkbox hide-when-print">
<th class="checkbox hide-when-print"> <%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> </th>
</th>
<% end %>
<th><%= l(:field_project) %></th> <th><%= l(:field_project) %></th>
<th><%= l(:field_label_dmsf_workflow) %></th> <th><%= l(:field_label_dmsf_workflow) %></th>
<th><%= l(:field_status) %></th> <th><%= l(:field_status) %></th>
<th><%= l(:label_document) %></th> <th><%= l(:label_document) %></th>
<th><%= l(:field_folder) %></th> <th><%= l(:field_folder) %></th>
<% unless easy_extension %> <th></th>
<th></th>
<% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% assignments.each do |assignment| %> <% assignments.each do |assignment| %>
<tr id="file-<%= assignment.dmsf_file_revision.dmsf_file.id %>" class="hascontextmenu"> <tr id="file-<%= assignment.dmsf_file_revision.dmsf_file.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "file-#{assignment.dmsf_file_revision.dmsf_file.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "file-#{assignment.dmsf_file_revision.dmsf_file.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<% if assignment.dmsf_file_revision.dmsf_file.project %> <% if assignment.dmsf_file_revision.dmsf_file.project %>
<%= link_to_project assignment.dmsf_file_revision.dmsf_file.project %> <%= link_to_project assignment.dmsf_file_revision.dmsf_file.project %>
@ -105,17 +96,15 @@
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
<% unless easy_extension %> <td class="buttons">
<td class="buttons"> <%= link_to_context_menu %>
<%= link_to_context_menu %> </td>
</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> <% end %>
<%= context_menu unless easy_extension %> <%= context_menu %>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>

View File

@ -25,38 +25,29 @@
:watchers => { watchable_type: 'DmsfFolder', user_id: @user&.id }) %> :watchers => { watchable_type: 'DmsfFolder', user_id: @user&.id }) %>
<% files = DmsfFile.visible.joins(:watchers).where( <% files = DmsfFile.visible.joins(:watchers).where(
:watchers => { watchable_type: 'DmsfFile', user_id: @user&.id }) %> :watchers => { watchable_type: 'DmsfFile', user_id: @user&.id }) %>
<% easy_extension = defined?(EasyExtensions) %> <h3><%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)</h3>
<% unless easy_extension %>
<h3><%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)</h3>
<% end %>
<% if projects.any? || folders.any? || files.any? %> <% if projects.any? || folders.any? || files.any? %>
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
<%= hidden_field_tag 'back_url', my_page_path, id: nil %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %>
<table class="list context-menu-container" data-hascontextmenu="true"> <table class="list context-menu-container" data-hascontextmenu="true">
<thead> <thead>
<tr> <tr>
<% unless easy_extension %> <th class="checkbox hide-when-print">
<th class="checkbox hide-when-print"> <%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> </th>
</th>
<% end %>
<th><%= l(:field_project) %></th> <th><%= l(:field_project) %></th>
<th><%= l(:label_document) %>/<%= l(:field_folder) %></th> <th><%= l(:label_document) %>/<%= l(:field_folder) %></th>
<th><%= l(:field_folder) %></th> <th><%= l(:field_folder) %></th>
<% unless easy_extension %> <th></th>
<th></th>
<% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% projects.each do |project| %> <% projects.each do |project| %>
<tr id="project-<%= project.id %>" class="hascontextmenu"> <tr id="project-<%= project.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "project-#{project.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "project-#{project.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<%= link_to_project project %> <%= link_to_project project %>
</td> </td>
@ -71,11 +62,9 @@
<% end %> <% end %>
<% folders.each do |folder| %> <% folders.each do |folder| %>
<tr id="folder-<%= folder.id %>" class="hascontextmenu"> <tr id="folder-<%= folder.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<%= link_to_project folder.project %> <%= link_to_project folder.project %>
</td> </td>
@ -98,11 +87,9 @@
<% end %> <% end %>
<% files.each do |file| %> <% files.each do |file| %>
<tr id="file-<%= file.id %>" class="hascontextmenu"> <tr id="file-<%= file.id %>" class="hascontextmenu">
<% unless easy_extension %> <td class="checkbox hide-when-print">
<td class="checkbox hide-when-print"> <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %>
<%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> </td>
</td>
<% end %>
<td class="project"> <td class="project">
<%= link_to_project(file.project) if file.project %> <%= link_to_project(file.project) if file.project %>
</td> </td>
@ -117,17 +104,15 @@
<%= link_to l(:link_documents), dmsf_folder_path(id: file.project) %> <%= link_to l(:link_documents), dmsf_folder_path(id: file.project) %>
<% end %> <% end %>
</td> </td>
<% unless easy_extension %> <td class="buttons">
<td class="buttons"> <%= link_to_context_menu %>
<%= link_to_context_menu %> </td>
</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> <% end %>
<%= context_menu unless easy_extension %> <%= context_menu %>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>

View File

@ -17,24 +17,14 @@
# <https://www.gnu.org/licenses/>. # <https://www.gnu.org/licenses/>.
%> %>
<% <em class="info">
if defined?(EasyExtensions)
klass = 'small dmsf-info'
title_klass = 'small dmsf-info dmsf-info-title'
else
klass = 'info';
title_klass = 'info'
end
%>
<em class="<%= title_klass %>">
<%= l(:label_general) %> <%= l(:label_general) %>
</em> </em>
<p> <p>
<%= content_tag :label, l(:label_maximum_files_download) %> <%= content_tag :label, l(:label_maximum_files_download) %>
<%= text_field_tag 'settings[dmsf_max_file_download]', RedmineDmsf.dmsf_max_file_download, size: 10 %> <%= text_field_tag 'settings[dmsf_max_file_download]', RedmineDmsf.dmsf_max_file_download, size: 10 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_maximum_number_of_files_downloaded) %><br> <%= l(:note_maximum_number_of_files_downloaded) %><br>
<%= l(:label_default) %>: 0 <%= l(:label_default) %>: 0
</em> </em>
@ -44,7 +34,7 @@
<%= content_tag :label, l(:label_dmsf_max_notification_receivers_info) %> <%= content_tag :label, l(:label_dmsf_max_notification_receivers_info) %>
<%= text_field_tag 'settings[dmsf_max_notification_receivers_info]', RedmineDmsf.dmsf_max_notification_receivers_info, <%= text_field_tag 'settings[dmsf_max_notification_receivers_info]', RedmineDmsf.dmsf_max_notification_receivers_info,
size: 10 %> size: 10 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_max_notification_receivers_info) %><br> <%= l(:note_dmsf_max_notification_receivers_info) %><br>
<%= l(:label_default) %>: 10 <%= l(:label_default) %>: 10
</em> </em>
@ -53,7 +43,7 @@
<p> <p>
<%= content_tag :label, l(:label_maximum_email_filesize) %> <%= content_tag :label, l(:label_maximum_email_filesize) %>
<%= text_field_tag 'settings[dmsf_max_email_filesize]', RedmineDmsf.dmsf_max_email_filesize, size: 10 %> <%= text_field_tag 'settings[dmsf_max_email_filesize]', RedmineDmsf.dmsf_max_email_filesize, size: 10 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_maximum_email_filesize) %><br> <%= l(:note_maximum_email_filesize) %><br>
<%= l(:label_default) %>: 0 <%= l(:label_default) %>: 0
</em> </em>
@ -62,7 +52,7 @@
<p> <p>
<%= content_tag :label, l(:label_file_storage_directory) %> <%= content_tag :label, l(:label_file_storage_directory) %>
<%= text_field_tag 'settings[dmsf_storage_directory]', RedmineDmsf.dmsf_storage_directory, size: 256 %> <%= text_field_tag 'settings[dmsf_storage_directory]', RedmineDmsf.dmsf_storage_directory, size: 256 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: files/dmsf <%= l(:label_default) %>: files/dmsf
</em> </em>
</p> </p>
@ -92,7 +82,7 @@
<small><%= l(:note_dmsf_office_bin_not_available, RedmineDmsf.office_bin ||= 'libreoffice') %></small> <small><%= l(:note_dmsf_office_bin_not_available, RedmineDmsf.office_bin ||= 'libreoffice') %></small>
</span> </span>
<% end %> <% end %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_office_bin) %><br> <%= l(:note_dmsf_office_bin) %><br>
<%= l(:label_default) %>: 'libreoffice' <%= l(:label_default) %>: 'libreoffice'
</em> </em>
@ -101,7 +91,7 @@
<p> <p>
<%= content_tag :label, l(:label_physical_file_delete) %> <%= content_tag :label, l(:label_physical_file_delete) %>
<%= check_box_tag 'settings[dmsf_really_delete_files]', '1', RedmineDmsf.physical_file_delete? %> <%= check_box_tag 'settings[dmsf_really_delete_files]', '1', RedmineDmsf.physical_file_delete? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default)%>: <%= l(:general_text_No)%> <%= l(:label_default)%>: <%= l(:general_text_No)%>
</em> </em>
</p> </p>
@ -113,7 +103,7 @@
[l(:select_option_deactivated), '0'], [l(:select_option_deactivated), '0'],
[l(:select_option_activated), '1']], [l(:select_option_activated), '1']],
selected: RedmineDmsf.dmsf_default_notifications? ? '1' : '0') %> selected: RedmineDmsf.dmsf_default_notifications? ? '1' : '0') %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= l(:select_option_deactivated) %> <%= l(:label_default) %>: <%= l(:select_option_deactivated) %>
</em> </em>
</p> </p>
@ -125,7 +115,7 @@
[l(:select_option_deactivated), '0'], [l(:select_option_deactivated), '0'],
[l(:select_option_activated), '1']], [l(:select_option_activated), '1']],
selected: RedmineDmsf.dmsf_display_notified_recipients? ? '1' : '0') %> selected: RedmineDmsf.dmsf_display_notified_recipients? ? '1' : '0') %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_display_notified_recipients) %><br> <%= l(:note_display_notified_recipients) %><br>
<%= l(:label_default) %>: <%= l(:select_option_deactivated) %> <%= l(:label_default) %>: <%= l(:select_option_deactivated) %>
</em> </em>
@ -134,7 +124,7 @@
<p> <p>
<%= content_tag :label, l(:label_title_format) %> <%= content_tag :label, l(:label_title_format) %>
<%= text_field_tag 'settings[dmsf_global_title_format]', RedmineDmsf.dmsf_global_title_format, size: 10 %> <%= text_field_tag 'settings[dmsf_global_title_format]', RedmineDmsf.dmsf_global_title_format, size: 10 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:text_title_format) %> <%= l(:text_title_format) %>
</em> </em>
</p> </p>
@ -142,7 +132,7 @@
<p> <p>
<%= content_tag :label, l(:label_act_as_attachable) %> <%= content_tag :label, l(:label_act_as_attachable) %>
<%= check_box_tag 'settings[dmsf_act_as_attachable]', '1', RedmineDmsf.dmsf_act_as_attachable? %> <%= check_box_tag 'settings[dmsf_act_as_attachable]', '1', RedmineDmsf.dmsf_act_as_attachable? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_act_as_attachable) %><br> <%= l(:note_dmsf_act_as_attachable) %><br>
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
@ -151,7 +141,7 @@
<p> <p>
<%= content_tag :label, l(:label_dmsf_projects_as_subfolders) %> <%= content_tag :label, l(:label_dmsf_projects_as_subfolders) %>
<%= check_box_tag 'settings[dmsf_projects_as_subfolders]', '1', RedmineDmsf.dmsf_projects_as_subfolders? %> <%= check_box_tag 'settings[dmsf_projects_as_subfolders]', '1', RedmineDmsf.dmsf_projects_as_subfolders? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_projects_as_subfolders) %><br> <%= l(:note_dmsf_projects_as_subfolders) %><br>
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
@ -160,7 +150,7 @@
<p> <p>
<%= content_tag :label, l(:label_dmsf_global_menu_disabled) %> <%= content_tag :label, l(:label_dmsf_global_menu_disabled) %>
<%= check_box_tag 'settings[dmsf_global_menu_disabled]', '1', RedmineDmsf.dmsf_global_menu_disabled? %> <%= check_box_tag 'settings[dmsf_global_menu_disabled]', '1', RedmineDmsf.dmsf_global_menu_disabled? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_global_menu_disabled) %><br> <%= l(:note_dmsf_global_menu_disabled) %><br>
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
@ -169,7 +159,7 @@
<p> <p>
<%= content_tag :label, l(:label_empty_minor_version_by_default) %> <%= content_tag :label, l(:label_empty_minor_version_by_default) %>
<%= check_box_tag 'settings[empty_minor_version_by_default]', '1', RedmineDmsf.empty_minor_version_by_default? %> <%= check_box_tag 'settings[empty_minor_version_by_default]', '1', RedmineDmsf.empty_minor_version_by_default? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
</p> </p>
@ -177,13 +167,13 @@
<p> <p>
<%= content_tag :label, l(:label_remove_original_documents_module) %> <%= content_tag :label, l(:label_remove_original_documents_module) %>
<%= check_box_tag 'settings[remove_original_documents_module]', '1', RedmineDmsf.remove_original_documents_module? %> <%= check_box_tag 'settings[remove_original_documents_module]', '1', RedmineDmsf.remove_original_documents_module? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
</p> </p>
<hr> <hr>
<em class="<%= title_klass %>"> <em class="info">
<%= l(:label_dmsf_columns) %> <%= l(:label_dmsf_columns) %>
</em> </em>
@ -198,14 +188,14 @@
</p> </p>
<hr> <hr>
<em class="<%= title_klass %>"> <em class="info">
<%= l(:heading_send_documents_by_email) %> <%= l(:heading_send_documents_by_email) %>
</em> </em>
<p> <p>
<%= content_tag :label, l(:label_email_from_override) %> <%= content_tag :label, l(:label_email_from_override) %>
<%= text_field_tag 'settings[dmsf_documents_email_from]', RedmineDmsf.dmsf_documents_email_from, size: 128 %> <%= text_field_tag 'settings[dmsf_documents_email_from]', RedmineDmsf.dmsf_documents_email_from, size: 128 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= l(:text_email_from_override) %> <%= l(:label_default) %>: <%= l(:text_email_from_override) %>
</em> </em>
</p> </p>
@ -213,7 +203,7 @@
<p> <p>
<%= content_tag :label, l(:label_email_reply_to) %> <%= content_tag :label, l(:label_email_reply_to) %>
<%= text_field_tag 'settings[dmsf_documents_email_reply_to]', RedmineDmsf.dmsf_documents_email_reply_to, size: 128 %> <%= text_field_tag 'settings[dmsf_documents_email_reply_to]', RedmineDmsf.dmsf_documents_email_reply_to, size: 128 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= "''" %> <%= l(:label_default) %>: <%= "''" %>
</em> </em>
</p> </p>
@ -221,20 +211,20 @@
<p> <p>
<%= content_tag :label, l(:label_links_only).capitalize %> <%= content_tag :label, l(:label_links_only).capitalize %>
<%= check_box_tag 'settings[dmsf_documents_email_links_only]', '1', RedmineDmsf.dmsf_documents_email_links_only? %> <%= check_box_tag 'settings[dmsf_documents_email_links_only]', '1', RedmineDmsf.dmsf_documents_email_links_only? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:label_default) %>: <%= l(:general_text_No) %> <%= l(:label_default) %>: <%= l(:general_text_No) %>
</em> </em>
</p> </p>
<hr> <hr>
<em class="<%= title_klass %>"> <em class="info">
<%= l(:field_label_dmsf_workflow) %> <%= l(:field_label_dmsf_workflow) %>
</em> </em>
<p> <p>
<%= content_tag :label, l(:label_dmsf_keep_documents_locked) %> <%= content_tag :label, l(:label_dmsf_keep_documents_locked) %>
<%= check_box_tag 'settings[dmsf_keep_documents_locked]', '1', RedmineDmsf.dmsf_keep_documents_locked? %> <%= check_box_tag 'settings[dmsf_keep_documents_locked]', '1', RedmineDmsf.dmsf_keep_documents_locked? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_dmsf_keep_documents_locked) %><br> <%= l(:note_dmsf_keep_documents_locked) %><br>
<%= l(:label_default)%>: <%= l(:general_text_No)%> <%= l(:label_default)%>: <%= l(:general_text_No)%>
</em> </em>
@ -243,28 +233,25 @@
<p> <p>
<%= content_tag(:label, l(:only_approval_zero_minor_version)) %> <%= content_tag(:label, l(:only_approval_zero_minor_version)) %>
<%= check_box_tag 'settings[only_approval_zero_minor_version]', '1', RedmineDmsf.only_approval_zero_minor_version? %> <%= check_box_tag 'settings[only_approval_zero_minor_version]', '1', RedmineDmsf.only_approval_zero_minor_version? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:only_approval_zero_minor_version) %><br> <%= l(:label_default) %>: <%= l(:general_text_No)%> <%= l(:only_approval_zero_minor_version) %><br> <%= l(:label_default) %>: <%= l(:general_text_No)%>
</em> </em>
</p> </p>
<hr> <hr>
<em class="<%= title_klass %>"> <em class="info">
<%= l(:label_webdav) %> <%= l(:label_webdav) %>
</em> </em>
<p> <p>
<%= content_tag :label, l(:label_webdav) %> <%= content_tag :label, l(:label_webdav) %>
<% disabled = defined?(EasyExtensions) && !(Redmine::Plugin.installed?('easy_hosting_services') &&
EasyHostingServices::EasyMultiTenancy.activated?) %>
<%= select_tag 'settings[dmsf_webdav]', <%= select_tag 'settings[dmsf_webdav]',
options_for_select([ options_for_select([
[l(:select_option_deactivated), '0'], [l(:select_option_deactivated), '0'],
[l(:select_option_activated), '1']], [l(:select_option_activated), '1']],
selected: RedmineDmsf.dmsf_webdav? ? '1' : '0'), selected: RedmineDmsf.dmsf_webdav? ? '1' : '0'),
disabled: disabled,
onchange: "$('#dmsf_webdav_block').toggle()" %> onchange: "$('#dmsf_webdav_block').toggle()" %>
<em class="<%= klass %>"> <em class="info">
<% if disabled %> <% if disabled %>
<% @settings['dmsf_webdav'] = '0' %> <% @settings['dmsf_webdav'] = '0' %>
<%= l(:note_webdav_disabled) %> <%= l(:note_webdav_disabled) %>
@ -283,7 +270,7 @@
<% auth_types = [%w[Basic Basic], %w[Digest Digest]] %> <% auth_types = [%w[Basic Basic], %w[Digest Digest]] %>
<%= select_tag 'settings[dmsf_webdav_authentication]', <%= select_tag 'settings[dmsf_webdav_authentication]',
options_for_select(auth_types, RedmineDmsf.dmsf_webdav_authentication) %> options_for_select(auth_types, RedmineDmsf.dmsf_webdav_authentication) %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_webdav_authentication) %><br> <%= l(:note_webdav_authentication) %><br>
<%= l(:label_default)%>: <%= auth_types[1][0] %> <%= l(:label_default)%>: <%= auth_types[1][0] %>
</em> </em>
@ -296,7 +283,7 @@
[l(:select_option_webdav_readwrite), 'WEBDAV_READ_WRITE']], [l(:select_option_webdav_readwrite), 'WEBDAV_READ_WRITE']],
selected: RedmineDmsf.dmsf_webdav_strategy), selected: RedmineDmsf.dmsf_webdav_strategy),
onchange: "$('#dmsf_webdav_ro_block').toggle()" %><br> onchange: "$('#dmsf_webdav_ro_block').toggle()" %><br>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_webdav_strategy) %><br> <%= l(:note_webdav_strategy) %><br>
<%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %> <%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %>
</em> </em>
@ -308,7 +295,7 @@
<p> <p>
<%= content_tag(:label, l(:label_webdav_ignore)) %> <%= content_tag(:label, l(:label_webdav_ignore)) %>
<%= text_field_tag 'settings[dmsf_webdav_ignore]', RedmineDmsf.dmsf_webdav_ignore, size: 50 %> <%= text_field_tag 'settings[dmsf_webdav_ignore]', RedmineDmsf.dmsf_webdav_ignore, size: 50 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_webdav_ignore) %> <%= l(:label_default) %>: ^(\._|\.DS_Store$|Thumbs.db$) <%= l(:note_webdav_ignore) %> <%= l(:label_default) %>: ^(\._|\.DS_Store$|Thumbs.db$)
</em> </em>
</p> </p>
@ -316,7 +303,7 @@
<%= content_tag(:label, l(:dmsf_webdav_ignore_1b_file_for_authentication)) %> <%= content_tag(:label, l(:dmsf_webdav_ignore_1b_file_for_authentication)) %>
<%= check_box_tag 'settings[dmsf_webdav_ignore_1b_file_for_authentication]', '1', <%= check_box_tag 'settings[dmsf_webdav_ignore_1b_file_for_authentication]', '1',
RedmineDmsf.dmsf_webdav_ignore_1b_file_for_authentication? %> RedmineDmsf.dmsf_webdav_ignore_1b_file_for_authentication? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:dmsf_webdav_ignore_1b_file_for_authentication_info) %><br> <%= l(:dmsf_webdav_ignore_1b_file_for_authentication_info) %><br>
<%= l(:label_default) %>: <%= l(:general_text_Yes) %> <%= l(:label_default) %>: <%= l(:general_text_Yes) %>
</em> </em>
@ -325,7 +312,7 @@
<%= content_tag :label, l(:label_webdav_disable_versioning) %> <%= content_tag :label, l(:label_webdav_disable_versioning) %>
<%= text_field_tag 'settings[dmsf_webdav_disable_versioning]', RedmineDmsf.dmsf_webdav_disable_versioning, <%= text_field_tag 'settings[dmsf_webdav_disable_versioning]', RedmineDmsf.dmsf_webdav_disable_versioning,
size: 50 %> size: 50 %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_webdav_disable_versioning) %><br> <%= l(:note_webdav_disable_versioning) %><br>
<%= l(:label_default) %>: ^\~\$|\.tmp$ <%= l(:label_default) %>: ^\~\$|\.tmp$
</em> </em>
@ -333,7 +320,7 @@
<p> <p>
<%= content_tag :label, l(:label_webdav_use_project_names) %> <%= content_tag :label, l(:label_webdav_use_project_names) %>
<%= check_box_tag 'settings[dmsf_webdav_use_project_names]', '1', RedmineDmsf.dmsf_webdav_use_project_names? %> <%= check_box_tag 'settings[dmsf_webdav_use_project_names]', '1', RedmineDmsf.dmsf_webdav_use_project_names? %>
<em class="<%= klass %>"> <em class="info">
<%= l(:note_webdav_use_project_names) %><br> <%= l(:note_webdav_use_project_names) %><br>
<%= l(:label_default)%>: <%= l(:general_text_No) %> <%= l(:label_default)%>: <%= l(:general_text_No) %>
</em> </em>
@ -343,63 +330,56 @@
<hr> <hr>
<em class="<%= title_klass %>"> <p>
<%= l(:label_full_text) %> <em class="info">
<%= l(:text_fulltext_search, cmd1: 'libreoffice', cmd2: 'pdftotext') %>
</em> </em>
</p>
<% if defined?(EasyExtensions) %> <% if RedmineDmsf::Plugin.lib_available?('xapian') %>
<p> <p>
<em class="<%= klass %>"> <%= content_tag :label, l(:label_index_database) %>
<%= l(:text_fulltext_search, cmd1: 'libreoffice', cmd2: 'pdftotext') %> <%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %>
<em class="info">
<%= l(:label_default) %>: <%= File.expand_path('dmsf_index', Rails.root) %>
</em>
</p>
<% stem_langs = %w(danish dutch english finnish french german hungarian italian norwegian portuguese romanian russian
spanish swedish turkish) %>
<p>
<%= content_tag :label, l(:label_stemming_language) %>
<%= select_tag 'settings[dmsf_stemming_lang]', options_for_select(stem_langs, RedmineDmsf.dmsf_stemming_lang) %>
<em class="info">
<%= l(:note_possible_values) %>: <%= stem_langs.join(', ') %>.<br>
<%= "#{l(:label_default)}: #{stem_langs[2]}" %>
</em>
</p>
<p>
<%= content_tag :label, l(:label_stem_strategy) %>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_NONE',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_NONE' %> <%= l(:option_stem_none) %>
<br>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_SOME' %> <%= l(:option_stem_some) %>
<br>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_ALL' %> <%= l(:option_stem_all) %>
<br>
<em class="info">
<%= l(:text_stemming_info) %>
</em>
</p>
<p>
<%= content_tag :label, l(:label_enable_cjk_ngrams) %>
<%= check_box_tag 'settings[dmsf_enable_cjk_ngrams]', '1', RedmineDmsf.dmsf_enable_cjk_ngrams? %>
<em class="info">
<%= l(:text_enable_cjk_ngrams) %><br>
<%= l(:label_default)%>: <%= l(:general_text_No) %>
</em> </em>
</p> </p>
<% else %> <% else %>
<% if RedmineDmsf::Plugin.lib_available?('xapian') %> <p class="warning"><%= l(:warning_xapian_not_available) %></p>
<p>
<%= content_tag :label, l(:label_index_database) %>
<%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %>
<em class="<%= klass %>">
<%= l(:label_default) %>: <%= File.expand_path('dmsf_index', Rails.root) %>
</em>
</p>
<% stem_langs = %w(danish dutch english finnish french german hungarian italian norwegian portuguese romanian russian
spanish swedish turkish) %>
<p>
<%= content_tag :label, l(:label_stemming_language) %>
<%= select_tag 'settings[dmsf_stemming_lang]', options_for_select(stem_langs, RedmineDmsf.dmsf_stemming_lang) %>
<em class="<%= klass %>">
<%= l(:note_possible_values) %>: <%= stem_langs.join(', ') %>.<br>
<%= "#{l(:label_default)}: #{stem_langs[2]}" %>
</em>
</p>
<p>
<%= content_tag :label, l(:label_stem_strategy) %>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_NONE',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_NONE' %> <%= l(:option_stem_none) %>
<br>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_SOME' %> <%= l(:option_stem_some) %>
<br>
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL',
RedmineDmsf.dmsf_stemming_strategy == 'STEM_ALL' %> <%= l(:option_stem_all) %>
<br>
<em class="<%= klass %>">
<%= l(:text_stemming_info) %>
</em>
</p>
<p>
<%= content_tag :label, l(:label_enable_cjk_ngrams) %>
<%= check_box_tag 'settings[dmsf_enable_cjk_ngrams]', '1', RedmineDmsf.dmsf_enable_cjk_ngrams? %>
<em class="<%= klass %>">
<%= l(:text_enable_cjk_ngrams) %><br>
<%= l(:label_default)%>: <%= l(:general_text_No) %>
</em>
</p>
<% else %>
<p class="warning"><%= l(:warning_xapian_not_available) %></p>
<% end %>
<% end %> <% end %>

View File

@ -404,12 +404,4 @@ function dmsfSetupFileDrop() {
} }
} }
if(typeof EASY == "undefined"){ $(document).ready(dmsfSetupFileDrop);
$(document).ready(dmsfSetupFileDrop);
}
else {
EASY.schedule.late(function () {
dmsfSetupFileDrop();
$(document).on("erui_new_dom", dmsfSetupFileDrop);
});
}

View File

@ -31,13 +31,6 @@ a.dmsf-label {
margin-left: 4px; margin-left: 4px;
} }
/* Query form */
.query-columns > span { /* EasyExtension */
display: inline-block;
height: 100%;
vertical-align: middle;
}
/* Revision's downloads box */ /* Revision's downloads box */
#dmsf_buttons.dmsf-controls { #dmsf_buttons.dmsf-controls {
float: left float: left
@ -164,15 +157,6 @@ div#dmsf_new_revision {
padding: 5px 0 0 0; padding: 5px 0 0 0;
} }
.dmsf-revision-access { /* EasyExtension */
margin-left: 0;
margin-right: 0;
}
div.dmsf-controls .dmsf-revision-action-button { /* EasyExtension */
border-style: none;
}
div[id*="revision_access_"] { div[id*="revision_access_"] {
display: none; display: none;
} }

View File

@ -82,7 +82,7 @@ hu:
title_lock_file: Zárolás, hogy más felhasználók nem tudjank változtatni rajt title_lock_file: Zárolás, hogy más felhasználók nem tudjank változtatni rajt
title_download_checked: Ellenőrzött letöltése a Zip archívumba title_download_checked: Ellenőrzött letöltése a Zip archívumba
title_send_checked_by_email: Kijelöltek küldése email-ben title_send_checked_by_email: Kijelöltek küldése email-ben
link_user_preferences: Easy DMS projekt preferenciák link_user_preferences: DMS projekt preferenciák
heading_send_documents_by_email: Dokumentumok küldése emailen heading_send_documents_by_email: Dokumentumok küldése emailen
label_email_from: Valakitől label_email_from: Valakitől
label_email_to: Valakinek label_email_to: Valakinek

View File

@ -82,7 +82,7 @@ nl:
title_lock_file: Vergrendel om wijzigingen door andere leden te voorkomen title_lock_file: Vergrendel om wijzigingen door andere leden te voorkomen
title_download_checked: Download aangevinkt in Zip archief title_download_checked: Download aangevinkt in Zip archief
title_send_checked_by_email: Verzending aangevinkt door e-mail title_send_checked_by_email: Verzending aangevinkt door e-mail
link_user_preferences: Easy DMS project voorkeuren link_user_preferences: DMS project voorkeuren
heading_send_documents_by_email: Verstuur documenten per e-mail heading_send_documents_by_email: Verstuur documenten per e-mail
label_email_from: Van label_email_from: Van
label_email_to: Aan label_email_to: Aan
@ -178,7 +178,7 @@ nl:
error_file_can_not_be_created: Bestand kan niet aangemaakt worden in opslag directory error_file_can_not_be_created: Bestand kan niet aangemaakt worden in opslag directory
error_wrong_zip_encoding: Onjuiste Zip encoding error_wrong_zip_encoding: Onjuiste Zip encoding
warning_xapian_not_available: Xapian niet beschikbaar warning_xapian_not_available: Xapian niet beschikbaar
menu_dmsf: Easy DMS menu_dmsf: DMS
label_physical_file_delete: Fysiek bestand verwijderen label_physical_file_delete: Fysiek bestand verwijderen
user_is_not_project_member: U bent geen lid van het project user_is_not_project_member: U bent geen lid van het project
heading_access_downloads_emails: Downloads/E-mails heading_access_downloads_emails: Downloads/E-mails
@ -187,7 +187,7 @@ nl:
label_dmsf_updated: Bijgewerkt label_dmsf_updated: Bijgewerkt
label_dmsf_downloaded: Gedownload label_dmsf_downloaded: Gedownload
title_total_size_of_all_files: Totale grootte van alle bestanden onder deze map title_total_size_of_all_files: Totale grootte van alle bestanden onder deze map
project_module_dmsf: Easy DMS project_module_dmsf: DMS
warning_no_project_to_copy_file_to: Geen project om bestand naar te kopiëren warning_no_project_to_copy_file_to: Geen project om bestand naar te kopiëren
comment_copied_from: "Gekopieerd van %{source}" comment_copied_from: "Gekopieerd van %{source}"
field_target_project: Doelproject field_target_project: Doelproject

View File

@ -168,11 +168,9 @@ if Redmine::Plugin.installed? 'redmine_dmsf'
end end
# WebDAV workaround for clients checking WebDAV availability in the root # WebDAV workaround for clients checking WebDAV availability in the root
unless defined?(EasyExtensions) match '/',
match '/', to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] },
to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] }, via: %i[propfind options]
via: %i[propfind options]
end
match '/dmsf', match '/dmsf',
to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] }, to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] },
via: %i[propfind options] via: %i[propfind options]

View File

@ -20,12 +20,8 @@
# Add column # Add column
class Dmsf090 < ActiveRecord::Migration[4.2] class Dmsf090 < ActiveRecord::Migration[4.2]
def up def up
if defined?(EasyExtensions) add_column :members, :dmsf_mail_notification, :boolean,
add_column :members, :dmsf_mail_notification, :boolean, default: false null: false, default: false
else
add_column :members, :dmsf_mail_notification, :boolean,
null: false, default: false
end
drop_table :dmsf_user_prefs drop_table :dmsf_user_prefs
end end

View File

@ -20,11 +20,7 @@
# Add column # Add column
class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration[4.2] class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration[4.2]
def change def change
if defined?(EasyExtensions) add_column :custom_fields, :dmsf_not_inheritable, :boolean,
add_column :custom_fields, :dmsf_not_inheritable, :boolean, default: false null: false, default: false
else
add_column :custom_fields, :dmsf_not_inheritable, :boolean,
null: false, default: false
end
end end
end end

View File

@ -82,8 +82,6 @@ Redmine::MenuManager.map :project_menu do |menu|
param: :id, param: :id,
html: { class: 'icon icon-dmsf' } html: { class: 'icon icon-dmsf' }
# New menu extension # New menu extension
next if defined?(EasyExtensions)
menu.push :dmsf_file, { controller: 'dmsf_upload', action: 'multi_upload' }, menu.push :dmsf_file, { controller: 'dmsf_upload', action: 'multi_upload' },
caption: :label_dmsf_new_top_level_document, parent: :new_object caption: :label_dmsf_new_top_level_document, parent: :new_object
menu.push :dmsf_folder, { controller: 'dmsf', action: 'new' }, menu.push :dmsf_folder, { controller: 'dmsf', action: 'new' },

View File

@ -216,84 +216,59 @@ end
# DMSF libraries # DMSF libraries
def after_easy_init(&block)
if defined?(EasyExtensions)
Rails.application.config.after_initialize(&block)
else
yield
end
end
# Validators # Validators
after_easy_init do require "#{File.dirname(__FILE__)}/../app/validators/dmsf_file_name_validator"
require "#{File.dirname(__FILE__)}/../app/validators/dmsf_file_name_validator" require "#{File.dirname(__FILE__)}/../app/validators/dmsf_max_file_size_validator"
require "#{File.dirname(__FILE__)}/../app/validators/dmsf_max_file_size_validator" require "#{File.dirname(__FILE__)}/../app/validators/dmsf_workflow_name_validator"
require "#{File.dirname(__FILE__)}/../app/validators/dmsf_workflow_name_validator" require "#{File.dirname(__FILE__)}/../app/validators/dmsf_url_validator"
require "#{File.dirname(__FILE__)}/../app/validators/dmsf_url_validator" require "#{File.dirname(__FILE__)}/../app/validators/dmsf_folder_parent_validator"
require "#{File.dirname(__FILE__)}/../app/validators/dmsf_folder_parent_validator"
end
# Patches # Patches
unless defined?(EasyPatchManager) require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/formatting_helper_patch"
require "#{File.dirname(__FILE__)}/../patches/formatting_helper_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/projects_helper_patch"
require "#{File.dirname(__FILE__)}/../patches/projects_helper_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/project_patch"
require "#{File.dirname(__FILE__)}/../patches/project_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/user_preference_patch"
require "#{File.dirname(__FILE__)}/../patches/user_preference_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/user_patch"
require "#{File.dirname(__FILE__)}/../patches/user_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/issue_patch"
require "#{File.dirname(__FILE__)}/../patches/issue_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/role_patch"
require "#{File.dirname(__FILE__)}/../patches/role_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/queries_controller_patch"
require "#{File.dirname(__FILE__)}/../patches/queries_controller_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/pdf_patch"
require "#{File.dirname(__FILE__)}/../patches/pdf_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/access_control_patch"
require "#{File.dirname(__FILE__)}/../patches/access_control_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/search_patch"
require "#{File.dirname(__FILE__)}/../patches/search_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/custom_field_patch"
require "#{File.dirname(__FILE__)}/../patches/custom_field_patch" require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/puma_patch"
require "#{File.dirname(__FILE__)}/../patches/puma_patch" # A workaround for obsolete 'alias_method' usage in RedmineUp's plugins
# A workaround for obsolete 'alias_method' usage in RedmineUp's plugins if RedmineDmsf::Plugin.an_obsolete_plugin_present?
if RedmineDmsf::Plugin.an_obsolete_plugin_present? require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/notifiable_ru_patch"
require "#{File.dirname(__FILE__)}/../patches/notifiable_ru_patch" else
else require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/notifiable_patch"
require "#{File.dirname(__FILE__)}/../patches/notifiable_patch"
end
end end
# Load up classes that make up our WebDAV solution ontop of Dav4rack # Load up classes that make up our WebDAV solution ontop of Dav4rack
after_easy_init do require "#{File.dirname(__FILE__)}/dav4rack"
require "#{File.dirname(__FILE__)}/dav4rack" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/custom_middleware"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/custom_middleware" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/base_resource"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/base_resource" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/dmsf_resource"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/dmsf_resource" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/index_resource"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/index_resource" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/project_resource"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/project_resource" require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/resource_proxy"
require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/resource_proxy"
end
# Hooks # Hooks
def require_hooks require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/account_controller_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/account_controller_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/issues_controller_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/issues_controller_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/search_controller_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/controllers/search_controller_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/view_projects_form_hook"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/view_projects_form_hook" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/base_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/base_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/custom_field_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/custom_field_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/issue_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/issue_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/mailer_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/mailer_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/my_account_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/my_account_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/search_view_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/views/search_view_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/issues_helper_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/issues_helper_hooks" require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/project_helper_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/search_helper_hooks"
require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/project_helper_hooks"
end
after_easy_init do
require_hooks
end
# Macros # Macros
after_easy_init do require "#{File.dirname(__FILE__)}/redmine_dmsf/macros"
require "#{File.dirname(__FILE__)}/redmine_dmsf/macros"
end
# Field formats # Field formats
after_easy_init do require "#{File.dirname(__FILE__)}/redmine_dmsf/field_formats/dmsf_file_revision_format"
require "#{File.dirname(__FILE__)}/redmine_dmsf/field_formats/dmsf_file_revision_format"
end

View File

@ -53,12 +53,7 @@ module RedmineDmsf
def controller_issues_bulk_edit_before_save(context = {}) def controller_issues_bulk_edit_before_save(context = {})
controller_issues_before_save context controller_issues_before_save context
# Call also the after safe hook, 'cause it's missing in Redmine # Call also the after safe hook, 'cause it's missing in Redmine
controller_issues_after_save(context, edit: true) unless defined?(EasyExtensions) controller_issues_after_save(context, edit: true)
end
# Unfortunately this hook is missing in Redmine. It's called in Easy Redmine only.
def controller_issues_bulk_edit_after_save(context = {})
controller_issues_after_save context, edit: true
end end
private private

View File

@ -1,48 +0,0 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Karel Pičman <karel.picman@kontron.com>
#
# This file is part of Redmine DMSF plugin.
#
# Redmine DMSF plugin 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 3 of the License, or (at your option) any
# later version.
#
# Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see
# <https://www.gnu.org/licenses/>.
module RedmineDmsf
module Hooks
module Helpers
# Search helper hooks
class SearchHelperHooks < Redmine::Hook::Listener
def helper_easy_extensions_search_helper_patch(context = {})
case context[:entity].event_type
when 'dmsf-file', 'dmsf-folder'
str = context[:controller].send(:render_to_string,
partial: 'search/container',
locals: { object: context[:entity] })
if str
html = +'<p class=\"file-detail-container\"><span><strong>'
html << if context[:entity].dmsf_folder_id
context[:entity].class.human_attribute_name(:folder)
else
context[:entity].class.human_attribute_name(:project)
end
html << ':</strong>'
html << str
html << '</span></p>'
context[:additional_result] << html
end
end
end
end
end
end
end

View File

@ -23,14 +23,12 @@ module RedmineDmsf
# Base view hooks # Base view hooks
class BaseViewHooks < Redmine::Hook::ViewListener class BaseViewHooks < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context = {}) def view_layouts_base_html_head(context = {})
unless /^(Dmsf|Projects|Issues|Queries|EasyCrmCases|MyController|SettingsController|WikiController)/.match?( unless /^(Dmsf|Projects|Issues|Queries|MyController|SettingsController|WikiController)/.match?(
context[:controller].class.name context[:controller].class.name
) )
return return
end end
context[:controller].send :render_to_string, { partial: 'hooks/redmine_dmsf/view_layouts_base_html_head' }
partial = "hooks/#{defined?(EasyExtensions) ? 'easy' : 'redmine'}_dmsf/view_layouts_base_html_head"
context[:controller].send :render_to_string, { partial: partial }
end end
end end
end end

View File

@ -26,8 +26,6 @@ module RedmineDmsf
include DmsfFilesHelper include DmsfFilesHelper
def view_issues_form_details_bottom(context = {}) def view_issues_form_details_bottom(context = {})
return if defined?(EasyExtensions)
context[:container] = context[:issue] context[:container] = context[:issue]
attach_documents_form(context) attach_documents_form(context)
end end
@ -36,7 +34,7 @@ module RedmineDmsf
html = +'' html = +''
container = context[:container] container = context[:container]
# Radio buttons # Radio buttons
if allowed_to_attach_documents(container) && allowed_to_attach_attachments(container) if allowed_to_attach_documents(container)
html << '<p>' html << '<p>'
classes = +'inline' classes = +'inline'
html << "<label class=\"#{classes}\">" html << "<label class=\"#{classes}\">"
@ -60,22 +58,17 @@ module RedmineDmsf
html << '</label>' html << '</label>'
html << '</p>' html << '</p>'
if User.current.pref.dmsf_attachments_upload_choice == 'DMSF' if User.current.pref.dmsf_attachments_upload_choice == 'DMSF'
html << context[:hook_caller].late_javascript_tag( html << context[:hook_caller].javascript_tag(
"$('.attachments-container:not(.dmsf-uploader)').hide();" "$('.attachments-container:not(.dmsf-uploader)').hide();"
) )
end end
end end
# Upload form # Upload form
html << attach_documents_form(context, label: false) if allowed_to_attach_documents(container) html << attach_documents_form(context, label: false) if allowed_to_attach_documents(container)
unless allowed_to_attach_attachments(container)
html << context[:hook_caller].late_javascript_tag("$('.attachments-container:not(.dmsf-uploader)').hide();")
end
html html
end end
def view_issues_show_description_bottom(context = {}) def view_issues_show_description_bottom(context = {})
return if defined?(EasyExtensions)
show_attached_documents context[:issue], context[:controller] show_attached_documents context[:issue], context[:controller]
end end
@ -101,7 +94,7 @@ module RedmineDmsf
def view_issues_edit_notes_bottom_style(context = {}) def view_issues_edit_notes_bottom_style(context = {})
if ((User.current.pref.dmsf_attachments_upload_choice == 'Attachments') || if ((User.current.pref.dmsf_attachments_upload_choice == 'Attachments') ||
!allowed_to_attach_documents(context[:container])) && allowed_to_attach_attachments(context[:container]) !allowed_to_attach_documents(context[:container]))
'' ''
else else
'display: none' 'display: none'
@ -120,14 +113,6 @@ module RedmineDmsf
true true
end end
def allowed_to_attach_attachments(container)
return true unless defined?(EasyExtensions)
return container.project.module_enabled?(:documents) if container.respond_to?(:project) && container.project
true
end
def get_links(container) def get_links(container)
links = [] links = []
if defined?(container.dmsf_files) && if defined?(container.dmsf_files) &&
@ -165,8 +150,7 @@ module RedmineDmsf
return unless allowed_to_attach_documents(container) return unless allowed_to_attach_documents(container)
html = +'<p' html = +'<p'
if User.current.pref.dmsf_attachments_upload_choice == 'Attachments' && if User.current.pref.dmsf_attachments_upload_choice == 'Attachments'
allowed_to_attach_attachments(container)
html << ' style="display: none;"' html << ' style="display: none;"'
end end
html << '>' html << '>'
@ -191,132 +175,9 @@ module RedmineDmsf
links = get_links(container) links = get_links(container)
return if links.blank? return if links.blank?
if defined?(EasyExtensions) controller.send :render_to_string,
attachment_rows links, container, controller { partial: 'dmsf_files/links',
else locals: { links: links, thumbnails: Setting.thumbnails_enabled? } }
controller.send :render_to_string,
{ partial: 'dmsf_files/links',
locals: { links: links, thumbnails: Setting.thumbnails_enabled? } }
end
end
def attachment_rows(links, container, controller)
return unless links.any?
html = "<tbody><tr><th colspan=\"4\">#{l(:label_dmsf_attachments)} (#{links.count})</th></tr>"
links.each do |dmsf_file, link, _created_at|
html << attachment_row(dmsf_file, link, container, controller)
end
html << '</tbody>'
html
end
def attachment_row(dmsf_file, link, container, controller)
html = link ? +'<tr class="dmsf-gray">' : +'<tr>'
# Checkbox
html << '<td></td>'
file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file })
# Title, size
html << '<td>'
data = "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}"
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(dmsf_file.name))
icon_class = icon_class_for_mime_type(dmsf_file.name)
html << link_to(sprite_icon(icon_name, h(dmsf_file.title)),
file_view_url,
target: '_blank',
rel: 'noopener',
class: "icon #{icon_class}",
title: h(dmsf_file.last_revision.try(:tooltip)),
'data-downloadurl' => data)
html << "<span class=\"size dmsf-size\">(#{number_to_human_size(dmsf_file.last_revision.size)})</span>"
if dmsf_file.description.present?
desc = clean_wiki_text(textilizable(dmsf_file.description))
html << " - #{h(desc)}"
end
html << '</td>'
# Author, updated at
html << '<td>'
author = "#{h(dmsf_file.last_revision.user)}, #{format_time(dmsf_file.last_revision.updated_at)}"
html << "<span class=\"author\">#{author}</span>"
html << '</td>'
# Command icons
html << '<td class="fast-icons easy-query-additional-ending-buttons hide-when-print">'
# Details
html << if User.current.allowed_to? :file_manipulation, dmsf_file.project
link_to sprite_icon('edit', ''), dmsf_file_path(id: dmsf_file),
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
class: 'icon icon-edit'
else
'<span class="icon"></span>'
end
# Email
html << link_to(sprite_icon('email', ''),
entries_operations_dmsf_path(id: dmsf_file.project, email_entries: 'email',
files: [dmsf_file.id]),
method: :post, title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
# Lock
html << if !dmsf_file.locked?
link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file),
title: l(:title_lock_file), class: 'icon icon-lock'
elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? ||
User.current.allowed_to?(:force_file_unlock, dmsf_file.project))
link_to sprite_icon('unlock', ''), unlock_dmsf_files_path(id: dmsf_file),
title: dmsf_file.locked_title, class: 'icon icon-unlock'
else
content_tag 'span',
sprite_icon('unlock', ''),
title: dmsf_file.locked_title,
class: 'icon icon-unlock'
end
if dmsf_file.locked?
html << ('<span class="icon"></span>' * 2)
else
# Notifications
html << if dmsf_file.notification
link_to sprite_icon('email', ''), notify_deactivate_dmsf_files_path(id: dmsf_file),
title: l(:title_notifications_active_deactivate), class: 'icon icon-email'
else
link_to sprite_icon('email-disabled', ''),
notify_activate_dmsf_files_path(id: dmsf_file),
title: l(:title_notifications_not_active_activate), class: 'icon icon-email-add'
end
# Delete
if container.attributes_editable? && ((link && User.current.allowed_to?(:file_manipulation,
dmsf_file.project)) || (!link &&
User.current.allowed_to?(:file_delete, dmsf_file.project)))
back_url = case container.class.name
when 'Issue'
issue_path container
when 'EasyCrmCase'
easy_crm_case_path container
end
url = if link
dmsf_link_path link, commit: 'yes', back_url: back_url
else
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: back_url
end
html << delete_link(url, icon_only: true)
end
end
# Approval workflow
if dmsf_file.last_revision.dmsf_workflow_id
wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id)
end
html << controller.send(:render_to_string,
{ partial: 'dmsf_workflows/approval_workflow_button',
locals: {
file: dmsf_file,
file_approval_allowed: User.current.allowed_to?(:file_approval,
dmsf_file.project),
workflows_available: DmsfWorkflow.exists?(['project_id = ? OR project_id IS NULL',
dmsf_file.project.id]),
project: dmsf_file.project,
wf: wf,
dmsf_link_id: nil
} })
html << '</td>'
html << '</tr>'
html
end end
end end
end end

View File

@ -43,4 +43,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
Redmine::AccessControl.prepend RedmineDmsf::Patches::AccessControlPatch unless defined?(EasyPatchManager) Redmine::AccessControl.prepend RedmineDmsf::Patches::AccessControlPatch

View File

@ -31,8 +31,4 @@ module RedmineDmsf
end end
# Apply patch # Apply patch
if defined?(EasyPatchManager) CustomField.include RedmineDmsf::Patches::CustomFieldPatch
EasyPatchManager.register_model_patch 'CustomField', 'RedmineDmsf::Patches::CustomFieldPatch'
else
CustomField.include RedmineDmsf::Patches::CustomFieldPatch
end

View File

@ -38,9 +38,8 @@ module RedmineDmsf
'..', '..', '..', 'assets', 'javascripts', 'lang', "dmsf_button-#{lang}.js") '..', '..', '..', 'assets', 'javascripts', 'lang', "dmsf_button-#{lang}.js")
lang = 'en' unless File.exist?(path) lang = 'en' unless File.exist?(path)
content_for :header_tags do content_for :header_tags do
plugin = defined?(EasyExtensions) ? nil : :redmine_dmsf javascript_include_tag("lang/dmsf_button-#{lang}", plugin: :redmine_dmsf) +
javascript_include_tag("lang/dmsf_button-#{lang}", plugin: plugin) + javascript_include_tag('dmsf_button', plugin: :redmine_dmsf) +
javascript_include_tag('dmsf_button', plugin: plugin) +
javascript_tag("jsToolBar.prototype.dmsfList = #{@dmsf_macro_list.to_json};") javascript_tag("jsToolBar.prototype.dmsfList = #{@dmsf_macro_list.to_json};")
end end
end end

View File

@ -162,8 +162,4 @@ module RedmineDmsf
end end
# Apply patch # Apply patch
if defined?(EasyPatchManager) Issue.prepend RedmineDmsf::Patches::IssuePatch
EasyPatchManager.register_model_patch 'Issue', 'RedmineDmsf::Patches::IssuePatch'
else
Issue.prepend RedmineDmsf::Patches::IssuePatch
end

View File

@ -42,6 +42,6 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
unless defined?(EasyPatchManager) || RedmineDmsf::Plugin.an_obsolete_plugin_present? unless RedmineDmsf::Plugin.an_obsolete_plugin_present?
Redmine::Notifiable.prepend RedmineDmsf::Patches::NotifiablePatch Redmine::Notifiable.prepend RedmineDmsf::Patches::NotifiablePatch
end end

View File

@ -46,8 +46,6 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) if RedmineDmsf::Plugin.an_obsolete_plugin_present?
EasyPatchManager.register_other_patch 'Redmine::Notifiable', 'RedmineDmsf::Patches::NotifiableRuPatch'
elsif RedmineDmsf::Plugin.an_obsolete_plugin_present?
Redmine::Notifiable.include RedmineDmsf::Patches::NotifiableRuPatch Redmine::Notifiable.include RedmineDmsf::Patches::NotifiableRuPatch
end end

View File

@ -41,9 +41,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) Redmine::Export::PDF::ITCPDF.prepend RedmineDmsf::Patches::PdfPatch
EasyPatchManager.register_patch_to_be_first 'Redmine::Export::PDF::ITCPDF', 'RedmineDmsf::Patches::PdfPatch',
prepend: true, first: true
else
Redmine::Export::PDF::ITCPDF.prepend RedmineDmsf::Patches::PdfPatch
end

View File

@ -132,8 +132,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) Project.prepend RedmineDmsf::Patches::ProjectPatch
EasyPatchManager.register_model_patch 'Project', 'RedmineDmsf::Patches::ProjectPatch', prepend: true
else
Project.prepend RedmineDmsf::Patches::ProjectPatch
end

View File

@ -49,4 +49,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
ProjectsController.send(:helper, RedmineDmsf::Patches::ProjectsHelperPatch) unless defined?(EasyPatchManager) ProjectsController.send(:helper, RedmineDmsf::Patches::ProjectsHelperPatch)

View File

@ -39,6 +39,6 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if !defined?(EasyPatchManager) && RedmineDmsf::Plugin.lib_available?('puma/const') if RedmineDmsf::Plugin.lib_available?('puma/const')
Puma::Const.include RedmineDmsf::Patches::PumaPatch Puma::Const.include RedmineDmsf::Patches::PumaPatch
end end

View File

@ -38,9 +38,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) QueriesController.prepend RedmineDmsf::Patches::QueriesControllerPatch
EasyPatchManager.register_controller_patch 'QueriesController', 'RedmineDmsf::Patches::QueriesControllerPatch',
prepend: true
else
QueriesController.prepend RedmineDmsf::Patches::QueriesControllerPatch
end

View File

@ -41,8 +41,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) Role.prepend RedmineDmsf::Patches::RolePatch
EasyPatchManager.register_model_patch 'Role', 'RedmineDmsf::Patches::RolePatch', prepend: true
else
Role.prepend RedmineDmsf::Patches::RolePatch
end

View File

@ -43,9 +43,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) Redmine::Search.prepend RedmineDmsf::Patches::SearchPatch
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
'RedmineDmsf::Patches::SearchPatch', prepend: true, first: true
else
Redmine::Search.prepend RedmineDmsf::Patches::SearchPatch
end

View File

@ -62,8 +62,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) User.prepend RedmineDmsf::Patches::UserPatch
EasyPatchManager.register_model_patch 'User', 'RedmineDmsf::Patches::UserPatch'
else
User.prepend RedmineDmsf::Patches::UserPatch
end

View File

@ -58,8 +58,4 @@ module RedmineDmsf
end end
# Apply the patch # Apply the patch
if defined?(EasyPatchManager) UserPreference.prepend RedmineDmsf::Patches::UserPreferencePatch
EasyPatchManager.register_model_patch 'UserPreference', 'RedmineDmsf::Patches::UserPreferencePatch'
else
UserPreference.prepend RedmineDmsf::Patches::UserPreferencePatch
end

View File

@ -30,8 +30,7 @@ module RedmineDmsf
# present. # present.
# It is related especially to plugins made by AlphaNode and RedmineUP. # It is related especially to plugins made by AlphaNode and RedmineUP.
def self.an_obsolete_plugin_present? def self.an_obsolete_plugin_present?
plugins = %w[easyproject/easy_plugins/easy_money redmine_questions redmine_db redmine_passwords redmine_resources plugins = %w[redmine_questions redmine_db redmine_passwords redmine_resources redmine_products redmine_finance]
redmine_products redmine_finance]
plugins.each do |plugin| plugins.each do |plugin|
return true if Plugin.present?(plugin) return true if Plugin.present?(plugin)
end end

View File

@ -77,19 +77,11 @@ module RedmineDmsf
raise Unauthorized raise Unauthorized
end end
token = Token.find_by(user_id: user.id, action: 'dmsf_webdav_digest') token = Token.find_by(user_id: user.id, action: 'dmsf_webdav_digest')
if token.nil? && defined?(EasyExtensions) unless token
if user.easy_digest_token_expired? Rails.logger.error "Digest authentication: no digest found for #{username}"
Rails.logger.error "Digest authentication: #{user} is locked" raise Unauthorized
raise Unauthorized
end
ha1 = user.easy_digest_token
else
unless token
Rails.logger.error "Digest authentication: no digest found for #{username}"
raise Unauthorized
end
ha1 = token.value
end end
ha1 = token.value
ha2 = ActiveSupport::Digest.hexdigest("#{request.env['REQUEST_METHOD']}:#{uri}") ha2 = ActiveSupport::Digest.hexdigest("#{request.env['REQUEST_METHOD']}:#{uri}")
required_response = if qop required_response = if qop
ActiveSupport::Digest.hexdigest("#{ha1}:#{nonce}:#{nc}:#{cnonce}:#{qop}:#{ha2}") ActiveSupport::Digest.hexdigest("#{ha1}:#{nonce}:#{nc}:#{cnonce}:#{qop}:#{ha2}")

View File

@ -1,54 +0,0 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Karel Pičman <karel.picman@kontron.com>
#
# This file is part of Redmine DMSF plugin.
#
# Redmine DMSF plugin 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 3 of the License, or (at your option) any
# later version.
#
# Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see
# <https://www.gnu.org/licenses/>.
module RedmineDmsf
module Patches
# AccessControl patch
# TODO: This is just a workaround to fix alias_method usage in Easy's plugins, which is in conflict with
# prepend and causes an infinite loop.
module AccessControlEasyPatch
##################################################################################################################
# Overridden methods
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
alias_method_chain :available_project_modules, :easy
end
end
end
# Class methods
module ClassMethods
def available_project_modules_with_easy
# Removes the original Documents from project's modules (replaced with DMSF)
modules = available_project_modules_without_easy
modules.delete(:documents) if RedmineDmsf.remove_original_documents_module?
modules
end
end
end
end
end
# Apply the patch
if defined?(EasyPatchManager)
EasyPatchManager.register_other_patch 'Redmine::AccessControl', 'RedmineDmsf::Patches::AccessControlEasyPatch'
end

View File

@ -1,40 +0,0 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Karel Pičman <karel.picman@kontron.com>
#
# This file is part of Redmine DMSF plugin.
#
# Redmine DMSF plugin 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 3 of the License, or (at your option) any
# later version.
#
# Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see
# <https://www.gnu.org/licenses/>.
module RedmineDmsf
module Patches
# Attachable
module AttachablePatch
##################################################################################################################
# Overridden methods
def has_attachments?
super || (defined?(dmsf_files) && dmsf_files.any?) || (defined?(dmsf_links) && dmsf_links.any?)
end
end
end
end
# Apply the patch
if defined?(EasyPatchManager)
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
'RedmineDmsf::Patches::AttachablePatch', prepend: true, first: true
else
Redmine::Acts::Attachable.prepend RedmineDmsf::Patches::AttachablePatch
end

View File

@ -33,8 +33,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
@jsmith.pref.save! @jsmith.pref.save!
get '/my/page' get '/my/page'
assert_response :success assert_response :success
return if defined?(EasyExtensions)
assert_select 'div#list-top' do assert_select 'div#list-top' do
assert_select 'h3', { text: "#{l(:open_approvals)} (1)" } assert_select 'h3', { text: "#{l(:open_approvals)} (1)" }
end end
@ -46,8 +44,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
@jsmith.pref.save! @jsmith.pref.save!
get '/my/page' get '/my/page'
assert_response :success assert_response :success
return if defined?(EasyExtensions)
assert_select 'div#list-top' do assert_select 'div#list-top' do
assert_select 'h3', { text: "#{l(:open_approvals)} (0)" } assert_select 'h3', { text: "#{l(:open_approvals)} (0)" }
end end
@ -60,8 +56,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
@admin.pref.save! @admin.pref.save!
get '/my/page' get '/my/page'
assert_response :success assert_response :success
return if defined?(EasyExtensions)
text = l(:locked_documents) text = l(:locked_documents)
text << " (0 #{l(:label_number_of_folders).downcase} / 1 #{l(:label_number_of_documents).downcase})" text << " (0 #{l(:label_number_of_folders).downcase} / 1 #{l(:label_number_of_documents).downcase})"
assert_select 'div#list-top' do assert_select 'div#list-top' do
@ -77,8 +71,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
@folder1.add_watcher @jsmith @folder1.add_watcher @jsmith
@project1.add_watcher @jsmith @project1.add_watcher @jsmith
get '/my/page' get '/my/page'
return if defined?(EasyExtensions)
assert_response :success assert_response :success
assert_select 'div#list-top' do assert_select 'div#list-top' do
assert_select 'h3', { text: "#{l(:label_dmsf_watched)} (2/1)" } assert_select 'h3', { text: "#{l(:label_dmsf_watched)} (2/1)" }

View File

@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
class AccessControlPatchTest < RedmineDmsf::Test::UnitTest class AccessControlPatchTest < RedmineDmsf::Test::UnitTest
def test_available_project_modules def test_available_project_modules
assert Redmine::AccessControl.available_project_modules.include?(:documents) assert Redmine::AccessControl.available_project_modules.include?(:documents)
return if defined?(EasyExtensions) # It doesn't work with Easy due to alias_method_change
with_settings plugin_redmine_dmsf: { 'remove_original_documents_module' => '1' } do with_settings plugin_redmine_dmsf: { 'remove_original_documents_module' => '1' } do
assert_not Redmine::AccessControl.available_project_modules.include?(:documents) assert_not Redmine::AccessControl.available_project_modules.include?(:documents)
end end

View File

@ -1,41 +0,0 @@
# frozen_string_literal: true
# Redmine plugin for Document Management System "Features"
#
# Karel Pičman <karel.picman@kontron.com>
#
# This file is part of Redmine DMSF plugin.
#
# Redmine DMSF plugin 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 3 of the License, or (at your option) any
# later version.
#
# Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see
# <https://www.gnu.org/licenses/>.
require File.expand_path('../../../test_helper', __FILE__)
# Attachable tests
class AttachablePatchTest < RedmineDmsf::Test::UnitTest
fixtures :issues, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
def setup
super
@issue1 = Issue.find 1
@issue5 = Issue.find 5
end
def test_has_attachmets
if defined?(EasyExtensions)
assert @issue1.has_attachments?
assert_not @issue5.has_attachments?
else
assert @issue1.dmsf_files.present?
assert @issue5.dmsf_files.blank?
end
end
end

View File

@ -31,20 +31,16 @@ class DmsfPluginTest < RedmineDmsf::Test::HelperTest
end end
def test_an_obsolete_plugin_present_no def test_an_obsolete_plugin_present_no
return if defined?(EasyExtensions)
# No such plugin is present # No such plugin is present
assert_not RedmineDmsf::Plugin.an_obsolete_plugin_present? assert_not RedmineDmsf::Plugin.an_obsolete_plugin_present?
end end
def test_an_obsolete_plugin_present_yes def test_an_obsolete_plugin_present_yes
unless defined?(EasyExtensions) # Create a fake redmine_checklists plugin
# Create a fake redmine_checklists plugin path = Rails.root.join('plugins/redmine_resources')
path = Rails.root.join('plugins/redmine_resources') FileUtils.mkdir_p path
FileUtils.mkdir_p path
end
assert RedmineDmsf::Plugin.an_obsolete_plugin_present? assert RedmineDmsf::Plugin.an_obsolete_plugin_present?
FileUtils.rm_rf(path) unless defined?(EasyExtensions) FileUtils.rm_rf path
end end
def test_lib_available? def test_lib_available?

View File

@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
class SearchPatchTest < RedmineDmsf::Test::UnitTest class SearchPatchTest < RedmineDmsf::Test::UnitTest
def test_available_search_types def test_available_search_types
assert Redmine::Search.available_search_types.include?('documents') assert Redmine::Search.available_search_types.include?('documents')
return if defined?(EasyExtensions) # It doesn't work with Easy due to alias_method_change
with_settings plugin_redmine_dmsf: { 'remove_original_documents_module' => '1' } do with_settings plugin_redmine_dmsf: { 'remove_original_documents_module' => '1' } do
assert_not Redmine::Search.available_search_types.include?('documents') assert_not Redmine::Search.available_search_types.include?('documents')
end end

View File

@ -36,9 +36,6 @@ class UserPatchTest < RedmineDmsf::Test::UnitTest
assert_equal 0, DmsfFolder.where(deleted_by_user_id: id).all.size assert_equal 0, DmsfFolder.where(deleted_by_user_id: id).all.size
assert_equal 0, DmsfLink.where(user_id: id).all.size assert_equal 0, DmsfLink.where(user_id: id).all.size
assert_equal 0, DmsfLink.where(deleted_by_user_id: id).all.size assert_equal 0, DmsfLink.where(deleted_by_user_id: id).all.size
# TODO: Expected: 0, Actual: 1 in Easy extension
return if defined?(EasyExtensions)
assert_equal 0, DmsfFolder.where(user_id: id).all.size assert_equal 0, DmsfFolder.where(user_id: id).all.size
assert_equal 0, DmsfLock.where(user_id: id).all.size assert_equal 0, DmsfLock.where(user_id: id).all.size
assert_equal 0, DmsfWorkflowStepAction.where(author_id: id).all.size assert_equal 0, DmsfWorkflowStepAction.where(author_id: id).all.size