From fac307354d349d1d8dd95e0774f44f57a4d09f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Thu, 3 Jul 2025 15:58:43 +0200 Subject: [PATCH] Removal of unnnecessary files --- .rubocop.yml | 8 +- Gemfile | 12 +- after_init.rb | 155 --------------- app/controllers/dmsf_controller.rb | 6 +- app/controllers/dmsf_upload_controller.rb | 1 - app/helpers/dmsf_helper.rb | 8 - app/helpers/dmsf_upload_helper.rb | 4 - app/models/dmsf_file.rb | 55 ------ app/models/dmsf_file_revision.rb | 4 - app/models/dmsf_folder.rb | 19 +- app/views/dmsf/_add_email.html.erb | 2 +- app/views/dmsf/_main.html.erb | 36 +--- app/views/dmsf/_query_list.html.erb | 12 +- app/views/dmsf/_query_rows.erb | 10 +- app/views/dmsf/copymove.html.erb | 2 +- app/views/dmsf/edit.html.erb | 18 +- app/views/dmsf/trash.html.erb | 18 -- app/views/dmsf_context_menus/dmsf.html.erb | 2 +- app/views/dmsf_context_menus/trash.html.erb | 2 +- app/views/dmsf_files/show.html.erb | 20 +- .../dmsf_folder_permissions/_new.html.erb | 2 +- app/views/dmsf_help/en/dmsf_help.html.erb | 3 +- app/views/dmsf_links/_form.html.erb | 6 +- app/views/dmsf_links/create.js.erb | 2 +- app/views/dmsf_upload/upload_files.html.erb | 2 +- app/views/dmsf_workflows/_action.html.erb | 2 +- .../dmsf_workflows/_new_step_modal.html.erb | 2 +- app/views/dmsf_workflows/_steps.html.erb | 2 +- app/views/dmsf_workflows/new.html.erb | 2 +- .../my/blocks/_locked_documents.html.erb | 54 ++---- app/views/my/blocks/_open_approvals.html.erb | 37 ++-- .../my/blocks/_watched_documents.html.erb | 53 ++---- app/views/settings/_dmsf_settings.html.erb | 176 ++++++++---------- assets/javascripts/attachments_dmsf.js | 10 +- assets/stylesheets/redmine_dmsf.css | 16 -- config/locales/hu.yml | 2 +- config/locales/nl.yml | 6 +- config/routes.rb | 8 +- db/migrate/04_dmsf_0_9_0.rb | 8 +- ...d_dmsf_not_inheritable_to_custom_fields.rb | 8 +- init.rb | 2 - lib/redmine_dmsf.rb | 113 +++++------ .../controllers/issues_controller_hooks.rb | 7 +- .../hooks/helpers/search_helper_hooks.rb | 48 ----- .../hooks/views/base_view_hooks.rb | 6 +- .../hooks/views/issue_view_hooks.rb | 153 +-------------- .../patches}/access_control_patch.rb | 2 +- .../patches}/custom_field_patch.rb | 6 +- .../patches}/formatting_helper_patch.rb | 5 +- .../redmine_dmsf/patches}/issue_patch.rb | 6 +- .../redmine_dmsf/patches}/notifiable_patch.rb | 2 +- .../patches}/notifiable_ru_patch.rb | 4 +- .../redmine_dmsf/patches}/pdf_patch.rb | 7 +- .../redmine_dmsf/patches}/project_patch.rb | 6 +- .../patches}/projects_helper_patch.rb | 2 +- .../redmine_dmsf/patches}/puma_patch.rb | 2 +- .../patches}/queries_controller_patch.rb | 7 +- .../redmine_dmsf/patches}/role_patch.rb | 6 +- .../redmine_dmsf/patches}/search_patch.rb | 7 +- .../redmine_dmsf/patches}/user_patch.rb | 6 +- .../patches}/user_preference_patch.rb | 6 +- lib/redmine_dmsf/plugin.rb | 3 +- lib/redmine_dmsf/webdav/dmsf_controller.rb | 16 +- patches/access_control_easy_patch.rb | 54 ------ patches/attachable_patch.rb | 40 ---- test/functional/my_controller_test.rb | 8 - test/unit/lib/acccess_control_patch_test.rb | 2 - test/unit/lib/attachable_patch_test.rb | 41 ---- .../unit/lib/redmine_dmsf/dmsf_plugin_test.rb | 12 +- test/unit/lib/search_patch_test.rb | 2 - test/unit/user_patch_test.rb | 3 - 71 files changed, 258 insertions(+), 1121 deletions(-) delete mode 100644 after_init.rb delete mode 100644 lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb rename {patches => lib/redmine_dmsf/patches}/access_control_patch.rb (97%) rename {patches => lib/redmine_dmsf/patches}/custom_field_patch.rb (84%) rename {patches => lib/redmine_dmsf/patches}/formatting_helper_patch.rb (93%) rename {patches => lib/redmine_dmsf/patches}/issue_patch.rb (96%) rename {patches => lib/redmine_dmsf/patches}/notifiable_patch.rb (94%) rename {patches => lib/redmine_dmsf/patches}/notifiable_ru_patch.rb (90%) rename {patches => lib/redmine_dmsf/patches}/pdf_patch.rb (82%) rename {patches => lib/redmine_dmsf/patches}/project_patch.rb (96%) rename {patches => lib/redmine_dmsf/patches}/projects_helper_patch.rb (97%) rename {patches => lib/redmine_dmsf/patches}/puma_patch.rb (94%) rename {patches => lib/redmine_dmsf/patches}/queries_controller_patch.rb (82%) rename {patches => lib/redmine_dmsf/patches}/role_patch.rb (88%) rename {patches => lib/redmine_dmsf/patches}/search_patch.rb (83%) rename {patches => lib/redmine_dmsf/patches}/user_patch.rb (94%) rename {patches => lib/redmine_dmsf/patches}/user_preference_patch.rb (90%) delete mode 100644 patches/access_control_easy_patch.rb delete mode 100644 patches/attachable_patch.rb delete mode 100644 test/unit/lib/attachable_patch_test.rb diff --git a/.rubocop.yml b/.rubocop.yml index 3d89c46c..a2a31632 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -84,7 +84,7 @@ Naming/AccessorMethodName: Naming/PredicateName: Exclude: - - patches/attachable_patch.rb # Easy tests + - patches/attachable_patch.rb Style/HashSyntax: EnforcedShorthandSyntax: either @@ -95,7 +95,7 @@ Style/ZeroLengthPredicate: Rails/BulkChangeTable: 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: Exclude: @@ -123,8 +123,8 @@ Rails/SkipsModelValidations: Rails/ThreeStateBooleanColumn: Exclude: - - db/migrate/04_dmsf_0_9_0.rb # Easy tests - - db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb # Easy tests + - db/migrate/04_dmsf_0_9_0.rb + - db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb Rails/UniqueValidationWithoutIndex: Exclude: diff --git a/Gemfile b/Gemfile index 54cd5def..f795a06a 100644 --- a/Gemfile +++ b/Gemfile @@ -24,14 +24,12 @@ source 'https://rubygems.org' do gem 'zip-zip' unless Dir.exist?(File.expand_path('../../vault', __FILE__)) # Redmine extensions - unless Dir.exist?(File.expand_path('../../easyproject', __FILE__)) - gem 'active_record_union' - gem 'simple_enum' - group :xapian do - gem 'xapian-ruby' - end + gem 'active_record_union' + gem 'simple_enum' + group :xapian do + gem 'xapian-ruby' end - unless %w[easyproject easy_gantt custom_tables] + unless %w[easy_gantt custom_tables] .any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) } group :test do gem 'rails-controller-testing' diff --git a/after_init.rb b/after_init.rb deleted file mode 100644 index 69dc126e..00000000 --- a/after_init.rb +++ /dev/null @@ -1,155 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Document Management System "Features" -# -# Vít Jonáš , Daniel Munn , Karel Pičman -# -# 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 -# . - -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 diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 86409958..d519770d 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -759,11 +759,7 @@ class DmsfController < ApplicationController def query retrieve_default_query true - @query = if defined?(EasyExtensions) - retrieve_query_without_easy_extensions DmsfQuery, true - else - retrieve_query DmsfQuery, true - end + @query = retrieve_query DmsfQuery, true end def retrieve_default_query(use_session) diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index 47bc2ba2..97159471 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -75,7 +75,6 @@ class DmsfUploadController < ApplicationController @attachment.author = User.current @attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16) @attachment.content_type = params[:content_type].presence - @attachment.skip_description_required = true if defined?(EasyExtensions) begin Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible, raise: false) saved = @attachment.save diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb index 18d39c74..bd306c62 100644 --- a/app/helpers/dmsf_helper.rb +++ b/app/helpers/dmsf_helper.rb @@ -24,14 +24,6 @@ require 'csv' module DmsfHelper 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) filename = sanitize_filename(filename) timestamp = DateTime.current.strftime('%y%m%d%H%M%S') diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index 0bfe0beb..818aa42c 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -98,10 +98,6 @@ module DmsfUploadHelper end 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) - 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 files.push file container.dmsf_file_added file if container && !new_object diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 70fe2eb4..1aa83990 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -628,66 +628,11 @@ class DmsfFile < ApplicationRecord id = Regexp.last_match(1).to_i case dmsf_folder.dmsf_folder&.title - when '.CRM cases' - EasyCrmCase.visible.find_by id: id when '.Issues' Issue.visible.find_by id: id 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 name end diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index edd941eb..7002f454 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -118,10 +118,6 @@ class DmsfFileRevision < ApplicationRecord remove_extension(filename).gsub(/_+/, ' ') 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) if dmsf_file.locked_for_user? errors.add :base, l(:error_file_is_locked) diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 99a1a232..eb6fdeee 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -117,11 +117,7 @@ class DmsfFolder < ApplicationRecord if folder&.system return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project) - if ['.Issues', '.CRM cases'].exclude?(folder.title) && - !folder.issue&.visible?(User.current) && - !folder.easy_crm_case&.visible?(User.current) - return false - end + return false if (folder.title != '.Issues') && !folder.issue&.visible?(User.current) end # Permissions to the folder? if folder.dmsf_folder_permissions.any? @@ -477,19 +473,6 @@ class DmsfFolder < ApplicationRecord @issue 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) # Attributes self.title = params[:dmsf_folder][:title].scrub.strip diff --git a/app/views/dmsf/_add_email.html.erb b/app/views/dmsf/_add_email.html.erb index da74da2e..9151550d 100644 --- a/app/views/dmsf/_add_email.html.erb +++ b/app/views/dmsf/_add_email.html.erb @@ -22,7 +22,7 @@ <%= form_tag(append_email_dmsf_path(id: @project), remote: true, method: :post, id: 'new-user-form') do %> <%= hidden_field_tag :project_id, @project.id %>

<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

- <%= 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') }')" %>
<%= render_principals_for_new_email @principals %> diff --git a/app/views/dmsf/_main.html.erb b/app/views/dmsf/_main.html.erb index 2aa3d0d8..4f1fb387 100644 --- a/app/views/dmsf/_main.html.erb +++ b/app/views/dmsf/_main.html.erb @@ -31,7 +31,7 @@ class: 'icon icon-add', data: { cy: 'button__create-folder--dmsf' } %> <% end %> <% end %> - <% if defined?(EasyExtensions) %> + <%= actions_dropdown do %> <%= render partial: 'dmsf_context_menus/main', locals: { folder_manipulation_allowed: @folder_manipulation_allowed, system_folder: @system_folder, @@ -40,19 +40,7 @@ locked: @locked, file_manipulation_allowed: @file_manipulation_allowed, trash_enabled: @trash_enabled, - 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 %> + notifications: @notifications} %> <% end %>
<% end %> @@ -103,24 +91,6 @@ <% 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 %> - -<% late_javascript_tag do %> +<% javascript_tag do %> "$('#ajax-indicator').hide();" <% end %> \ No newline at end of file diff --git a/app/views/dmsf/_query_list.html.erb b/app/views/dmsf/_query_list.html.erb index b517114a..0b5da808 100644 --- a/app/views/dmsf/_query_list.html.erb +++ b/app/views/dmsf/_query_list.html.erb @@ -27,15 +27,9 @@ - <% if defined?(EasyExtensions) %> - <%# Easy checkbox %> - <%= content_tag :th, link_to_function('', 'EASY.contextMenu.toggleIssuesSelection($(this))', - title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}", class: 'icon icon-checked') %> - <% else %> - - <% end %> + <% query.inline_columns.each do |column| %> <%= column_header(query, column, query_options) %> <% end %> diff --git a/app/views/dmsf/_query_rows.erb b/app/views/dmsf/_query_rows.erb index 0feebeec..3ccc2ff4 100644 --- a/app/views/dmsf/_query_rows.erb +++ b/app/views/dmsf/_query_rows.erb @@ -46,20 +46,14 @@ <% end %> <% end %> <% unless query.deleted || query&.project.nil? %> - <%= late_javascript_tag do %> + <%= javascript_tag do %> $(function() { $("table.dmsf tr").removeClass("ui-draggable-dragging ui-droppable-active ui-droppable-hover ui-draggable-handle"); $(".dmsf-draggable").draggable({ diff --git a/app/views/dmsf/copymove.html.erb b/app/views/dmsf/copymove.html.erb index f233287d..35da3fe1 100644 --- a/app/views/dmsf/copymove.html.erb +++ b/app/views/dmsf/copymove.html.erb @@ -56,7 +56,7 @@ <% end %> <% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $('#move_button').click(function(event) { $('input#copy_entries').remove() }); diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index 7723c73b..f822f36a 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -33,7 +33,7 @@ back_url: edit_dmsf_url(id: @project, folder_id: @folder)), title: l(:title_lock_file), class: 'icon icon-lock' %> <% end %> - <% if defined?(EasyExtensions) %> + <%= actions_dropdown do %> <%= render partial: 'dmsf_context_menus/folder', locals: { dmsf_folder: @folder, locked: @folder.locked?, @@ -47,22 +47,6 @@ notifications: @notifications, 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 %> diff --git a/app/views/dmsf/trash.html.erb b/app/views/dmsf/trash.html.erb index c6b9ae91..1521afd5 100644 --- a/app/views/dmsf/trash.html.erb +++ b/app/views/dmsf/trash.html.erb @@ -40,21 +40,3 @@ <% content_for :sidebar do %> <%= render partial: 'dmsf/sidebar' %> <% 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 %> diff --git a/app/views/dmsf_context_menus/dmsf.html.erb b/app/views/dmsf_context_menus/dmsf.html.erb index 8baef237..ba74aba8 100644 --- a/app/views/dmsf_context_menus/dmsf.html.erb +++ b/app/views/dmsf_context_menus/dmsf.html.erb @@ -38,7 +38,7 @@ <% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $('#dmsf-cm-delete').click(function (event) { $('#context-menu').hide(); }); diff --git a/app/views/dmsf_context_menus/trash.html.erb b/app/views/dmsf_context_menus/trash.html.erb index 867435c4..dd894cc6 100644 --- a/app/views/dmsf_context_menus/trash.html.erb +++ b/app/views/dmsf_context_menus/trash.html.erb @@ -31,7 +31,7 @@ allowed_restore: @allowed_restore }) %> <% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $('#dmsf-cm-delete').click(function (event) { $('#context-menu').hide(); }); diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index bbb7cf79..f8138ba2 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -37,16 +37,10 @@ lock_dmsf_files_path(id: @file, back_url: dmsf_file_path(id: @file)), title: l(:title_lock_file), class: 'icon icon-lock' %> <% end %> - <% if defined?(EasyExtensions) %> + <%= 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)} %> - <% 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 %> + notifications: @notifications, back_url: dmsf_file_path(id: @file) } %> <% end %> <% end %> <% end %> @@ -72,16 +66,10 @@
- <% if defined?(EasyExtensions) %> + <%= 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 } %> - <% 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 %>
@@ -176,7 +164,7 @@ <% end %> <% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $('a.delete-revision').click(function(event) { if(!window.confirm('<%= l(:text_are_you_sure) %>')) { event.preventDefault(); diff --git a/app/views/dmsf_folder_permissions/_new.html.erb b/app/views/dmsf_folder_permissions/_new.html.erb index f70d286d..7c5b6721 100644 --- a/app/views/dmsf_folder_permissions/_new.html.erb +++ b/app/views/dmsf_folder_permissions/_new.html.erb @@ -21,7 +21,7 @@ <%= form_tag(append_dmsf_folder_permissions_path, remote: true, method: :post, id: 'new-user-form') do %> <%= hidden_field_tag :project_id, @project.id %>

<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

- <%= 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, dmsf_folder_id: @dmsf_folder) }')" %>
diff --git a/app/views/dmsf_help/en/dmsf_help.html.erb b/app/views/dmsf_help/en/dmsf_help.html.erb index 82e1aed4..754e2846 100644 --- a/app/views/dmsf_help/en/dmsf_help.html.erb +++ b/app/views/dmsf_help/en/dmsf_help.html.erb @@ -4,8 +4,7 @@ Wiki formatting <%= stylesheet_link_tag 'wiki_syntax.css' %> - <% plugin = defined?(EasyExtensions) ? nil : :redmine_dmsf %> - <%= stylesheet_link_tag 'dmsf_help.css', plugin: plugin %> + <%= stylesheet_link_tag 'dmsf_help.css', plugin: :redmine_dmsf %> diff --git a/app/views/dmsf_links/_form.html.erb b/app/views/dmsf_links/_form.html.erb index 708a2ee0..a9001146 100644 --- a/app/views/dmsf_links/_form.html.erb +++ b/app/views/dmsf_links/_form.html.erb @@ -45,7 +45,7 @@ <%= select_tag 'dmsf_link[target_project_id]', project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, selected: @dmsf_link.target_project) %> - <%= late_javascript_tag do %> + <%= javascript_tag do %> $('#dmsf_link_target_project_id').change(function(){ $.ajax({ url: '<%= escape_javascript autocomplete_for_project_dmsf_link_path(@project, format: 'js') %>', @@ -71,7 +71,7 @@ <% if !@fast_links || (@type != 'link_to') %> <%= select_tag 'dmsf_link[target_folder_id]', 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(){ $.ajax({ url: '<%= escape_javascript autocomplete_for_folder_dmsf_link_path(@project, format: 'js') %>', @@ -109,7 +109,7 @@
<% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $(document).ready(function(){ <%# Select2 extension, TODO: in case of a modal window, select2 makes problems %> <% unless modal || @fast_links %> diff --git a/app/views/dmsf_links/create.js.erb b/app/views/dmsf_links/create.js.erb index 3007d210..0fb92259 100644 --- a/app/views/dmsf_links/create.js.erb +++ b/app/views/dmsf_links/create.js.erb @@ -32,4 +32,4 @@ var awf = false; <% end %> <% end %> -dmsfAddLink(linksSpan, linkId, linkName, title, project, awf, <%= !defined?(EasyExtensions) %>); +dmsfAddLink(linksSpan, linkId, linkName, title, project, awf); diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index 6536feac..ac6d6cde 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -48,7 +48,7 @@ <% end %> <% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> // When the user scrolls the page, execute scrollFunction window.onscroll = function() { scrollFunction(); diff --git a/app/views/dmsf_workflows/_action.html.erb b/app/views/dmsf_workflows/_action.html.erb index ee33634e..dfadb347 100644 --- a/app/views/dmsf_workflows/_action.html.erb +++ b/app/views/dmsf_workflows/_action.html.erb @@ -41,7 +41,7 @@
<%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %>
<%= 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])}')" %>
<%= render_principals_for_new_dmsf_workflow_users( @dmsf_workflow, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id]) %> diff --git a/app/views/dmsf_workflows/_new_step_modal.html.erb b/app/views/dmsf_workflows/_new_step_modal.html.erb index 060753ac..eb629aee 100644 --- a/app/views/dmsf_workflows/_new_step_modal.html.erb +++ b/app/views/dmsf_workflows/_new_step_modal.html.erb @@ -24,7 +24,7 @@
<%= l(:label_dmsf_workflow_add_approver) %>

<%= label_tag 'user_search', l(:label_user_search) %><%= 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: 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) }')" %>
<%= render_principals_for_new_dmsf_workflow_users @dmsf_workflow %>
diff --git a/app/views/dmsf_workflows/_steps.html.erb b/app/views/dmsf_workflows/_steps.html.erb index bdb71dee..4b0b9b11 100644 --- a/app/views/dmsf_workflows/_steps.html.erb +++ b/app/views/dmsf_workflows/_steps.html.erb @@ -133,6 +133,6 @@ <% end %>
-<%= late_javascript_tag do %> +<%= javascript_tag do %> $(function() { $("table.steps tbody").positionedItems(); }); <% end %> diff --git a/app/views/dmsf_workflows/new.html.erb b/app/views/dmsf_workflows/new.html.erb index f8a321fc..b6d98dbe 100644 --- a/app/views/dmsf_workflows/new.html.erb +++ b/app/views/dmsf_workflows/new.html.erb @@ -45,7 +45,7 @@
<% end %> -<%= late_javascript_tag do %> +<%= javascript_tag do %> $('#dmsf_workflow_id').change(function () { $('#content').load("<%= @project ? url_for(action: 'new', project_id: @project.id) : url_for(action: 'new') %>", $('#new_dmsf_workflow').serialize()); }); diff --git a/app/views/my/blocks/_locked_documents.html.erb b/app/views/my/blocks/_locked_documents.html.erb index 6c250741..409770f2 100644 --- a/app/views/my/blocks/_locked_documents.html.erb +++ b/app/views/my/blocks/_locked_documents.html.erb @@ -27,40 +27,28 @@ '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 > ?)', 0, @user&.id, Time.current]) %> -<% easy_extension = defined?(EasyExtensions) %> -<% unless easy_extension %> -

- <%= l(:locked_documents)%> (<%= "#{folders.all.size} #{l(:label_number_of_folders).downcase}" %> / <%= "#{files.all.size} #{l(:label_number_of_documents).downcase}" %>) -

-<% end %> <% if folders.any? || files.any?%> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %>
- <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> - + <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> + <% unless node.system %> - <% if defined?(EasyExtensions) %> - <%= 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 %> + <%= link_to_context_menu %> <% end %>
- <% unless easy_extension %> - - <% end %> + - <% unless easy_extension %> - - <% end %> + <% folders.each do |folder| %> - <% unless easy_extension %> - - <% end %> + @@ -76,20 +64,16 @@ <%= link_to l(:link_documents), dmsf_folder_path(id: folder.project) %> <% end %> - <% unless easy_extension %> - - <% end %> + <% end %> <% files.each do |file| %> - <% unless easy_extension %> - - <% end %> + @@ -104,17 +88,15 @@ <%= link_to_if file.project, l(:link_documents), dmsf_folder_path(id: file.project) %> <% end %> - <% unless easy_extension %> - - <% end %> + <% end %>
- <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', - title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> - + <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', + title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> + <%= l(:field_project) %> <%= l(:label_document) %>/<%= l(:field_folder) %> <%= l(:field_folder) %>
- <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> - + <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> + <%= link_to_project folder.project %> - <%= link_to_context_menu %> - + <%= link_to_context_menu %> +
- <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> - + <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> + <%= link_to_project file.project %> - <%= link_to_context_menu %> - + <%= link_to_context_menu %> +
<% end %> - <%= context_menu unless easy_extension %> + <%= context_menu %> <% else %>

<%= l(:label_no_data) %>

<% end %> diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb index 65ff6c14..d52e6d2a 100644 --- a/app/views/my/blocks/_open_approvals.html.erb +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -30,40 +30,31 @@ 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.uniq! { |a| a.dmsf_file_revision } %> -<% easy_extension = defined?(EasyExtensions) %> -<% unless easy_extension %> -

<%= l(:open_approvals)%> (<%= assignments.size %>)

-<% end %> +

<%= l(:open_approvals)%> (<%= assignments.size %>)

<% if assignments.any? %> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %> - <% unless easy_extension %> - - <% end %> + - <% unless easy_extension %> - - <% end %> + <% assignments.each do |assignment| %> - <% unless easy_extension %> - - <% end %> + - <% unless easy_extension %> - - <% end %> + <% end %>
- <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', - title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> - + <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', + title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> + <%= l(:field_project) %> <%= l(:field_label_dmsf_workflow) %> <%= l(:field_status) %> <%= l(:label_document) %> <%= l(:field_folder) %>
- <%= 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 %> + <% if assignment.dmsf_file_revision.dmsf_file.project %> <%= link_to_project assignment.dmsf_file_revision.dmsf_file.project %> @@ -105,17 +96,15 @@ <% end %> <% end %> - <%= link_to_context_menu %> - + <%= link_to_context_menu %> +
<% end %> - <%= context_menu unless easy_extension %> + <%= context_menu %> <% else %>

<%= l(:label_no_data) %>

<% end %> diff --git a/app/views/my/blocks/_watched_documents.html.erb b/app/views/my/blocks/_watched_documents.html.erb index 9e0b0bdb..2bb9c4da 100644 --- a/app/views/my/blocks/_watched_documents.html.erb +++ b/app/views/my/blocks/_watched_documents.html.erb @@ -25,38 +25,29 @@ :watchers => { watchable_type: 'DmsfFolder', user_id: @user&.id }) %> <% files = DmsfFile.visible.joins(:watchers).where( :watchers => { watchable_type: 'DmsfFile', user_id: @user&.id }) %> -<% easy_extension = defined?(EasyExtensions) %> -<% unless easy_extension %> -

<%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)

-<% end %> +

<%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)

<% if projects.any? || folders.any? || files.any? %> <%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %> <%= hidden_field_tag 'back_url', my_page_path, id: nil %> - <% unless easy_extension %> - - <% end %> + - <% unless easy_extension %> - - <% end %> + <% projects.each do |project| %> - <% unless easy_extension %> - - <% end %> + @@ -71,11 +62,9 @@ <% end %> <% folders.each do |folder| %> - <% unless easy_extension %> - - <% end %> + @@ -98,11 +87,9 @@ <% end %> <% files.each do |file| %> - <% unless easy_extension %> - - <% end %> + @@ -117,17 +104,15 @@ <%= link_to l(:link_documents), dmsf_folder_path(id: file.project) %> <% end %> - <% unless easy_extension %> - - <% end %> + <% end %>
- <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', - title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> - + <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', + title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> + <%= l(:field_project) %> <%= l(:label_document) %>/<%= l(:field_folder) %> <%= l(:field_folder) %>
- <%= check_box_tag 'ids[]', "project-#{project.id}", false, id: nil %> - + <%= check_box_tag 'ids[]', "project-#{project.id}", false, id: nil %> + <%= link_to_project project %>
- <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> - + <%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %> + <%= link_to_project folder.project %>
- <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> - + <%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %> + <%= link_to_project(file.project) if file.project %> - <%= link_to_context_menu %> - + <%= link_to_context_menu %> +
<% end %> - <%= context_menu unless easy_extension %> + <%= context_menu %> <% else %>

<%= l(:label_no_data) %>

<% end %> diff --git a/app/views/settings/_dmsf_settings.html.erb b/app/views/settings/_dmsf_settings.html.erb index a8c9fa13..e329534f 100644 --- a/app/views/settings/_dmsf_settings.html.erb +++ b/app/views/settings/_dmsf_settings.html.erb @@ -17,24 +17,14 @@ # . %> -<% - if defined?(EasyExtensions) - klass = 'small dmsf-info' - title_klass = 'small dmsf-info dmsf-info-title' - else - klass = 'info'; - title_klass = 'info' - end -%> - - + <%= l(:label_general) %>

<%= content_tag :label, l(:label_maximum_files_download) %> <%= text_field_tag 'settings[dmsf_max_file_download]', RedmineDmsf.dmsf_max_file_download, size: 10 %> - + <%= l(:note_maximum_number_of_files_downloaded) %>
<%= l(:label_default) %>: 0
@@ -44,7 +34,7 @@ <%= 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, size: 10 %> - + <%= l(:note_dmsf_max_notification_receivers_info) %>
<%= l(:label_default) %>: 10
@@ -53,7 +43,7 @@

<%= content_tag :label, l(:label_maximum_email_filesize) %> <%= text_field_tag 'settings[dmsf_max_email_filesize]', RedmineDmsf.dmsf_max_email_filesize, size: 10 %> - + <%= l(:note_maximum_email_filesize) %>
<%= l(:label_default) %>: 0
@@ -62,7 +52,7 @@

<%= content_tag :label, l(:label_file_storage_directory) %> <%= text_field_tag 'settings[dmsf_storage_directory]', RedmineDmsf.dmsf_storage_directory, size: 256 %> - + <%= l(:label_default) %>: files/dmsf

@@ -92,7 +82,7 @@ <%= l(:note_dmsf_office_bin_not_available, RedmineDmsf.office_bin ||= 'libreoffice') %> <% end %> - + <%= l(:note_dmsf_office_bin) %>
<%= l(:label_default) %>: 'libreoffice'
@@ -101,7 +91,7 @@

<%= content_tag :label, l(:label_physical_file_delete) %> <%= check_box_tag 'settings[dmsf_really_delete_files]', '1', RedmineDmsf.physical_file_delete? %> - + <%= l(:label_default)%>: <%= l(:general_text_No)%>

@@ -113,7 +103,7 @@ [l(:select_option_deactivated), '0'], [l(:select_option_activated), '1']], selected: RedmineDmsf.dmsf_default_notifications? ? '1' : '0') %> - + <%= l(:label_default) %>: <%= l(:select_option_deactivated) %>

@@ -125,7 +115,7 @@ [l(:select_option_deactivated), '0'], [l(:select_option_activated), '1']], selected: RedmineDmsf.dmsf_display_notified_recipients? ? '1' : '0') %> - + <%= l(:note_display_notified_recipients) %>
<%= l(:label_default) %>: <%= l(:select_option_deactivated) %>
@@ -134,7 +124,7 @@

<%= content_tag :label, l(:label_title_format) %> <%= text_field_tag 'settings[dmsf_global_title_format]', RedmineDmsf.dmsf_global_title_format, size: 10 %> - + <%= l(:text_title_format) %>

@@ -142,7 +132,7 @@

<%= content_tag :label, l(:label_act_as_attachable) %> <%= check_box_tag 'settings[dmsf_act_as_attachable]', '1', RedmineDmsf.dmsf_act_as_attachable? %> - + <%= l(:note_dmsf_act_as_attachable) %>
<%= l(:label_default) %>: <%= l(:general_text_No) %>
@@ -151,7 +141,7 @@

<%= content_tag :label, l(:label_dmsf_projects_as_subfolders) %> <%= check_box_tag 'settings[dmsf_projects_as_subfolders]', '1', RedmineDmsf.dmsf_projects_as_subfolders? %> - + <%= l(:note_dmsf_projects_as_subfolders) %>
<%= l(:label_default) %>: <%= l(:general_text_No) %>
@@ -160,7 +150,7 @@

<%= content_tag :label, l(:label_dmsf_global_menu_disabled) %> <%= check_box_tag 'settings[dmsf_global_menu_disabled]', '1', RedmineDmsf.dmsf_global_menu_disabled? %> - + <%= l(:note_dmsf_global_menu_disabled) %>
<%= l(:label_default) %>: <%= l(:general_text_No) %>
@@ -169,7 +159,7 @@

<%= 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? %> - + <%= l(:label_default) %>: <%= l(:general_text_No) %>

@@ -177,13 +167,13 @@

<%= content_tag :label, l(:label_remove_original_documents_module) %> <%= check_box_tag 'settings[remove_original_documents_module]', '1', RedmineDmsf.remove_original_documents_module? %> - + <%= l(:label_default) %>: <%= l(:general_text_No) %>


- + <%= l(:label_dmsf_columns) %> @@ -198,14 +188,14 @@


- + <%= l(:heading_send_documents_by_email) %>

<%= content_tag :label, l(:label_email_from_override) %> <%= text_field_tag 'settings[dmsf_documents_email_from]', RedmineDmsf.dmsf_documents_email_from, size: 128 %> - + <%= l(:label_default) %>: <%= l(:text_email_from_override) %>

@@ -213,7 +203,7 @@

<%= 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 %> - + <%= l(:label_default) %>: <%= "''" %>

@@ -221,20 +211,20 @@

<%= content_tag :label, l(:label_links_only).capitalize %> <%= check_box_tag 'settings[dmsf_documents_email_links_only]', '1', RedmineDmsf.dmsf_documents_email_links_only? %> - + <%= l(:label_default) %>: <%= l(:general_text_No) %>


- + <%= l(:field_label_dmsf_workflow) %>

<%= content_tag :label, l(:label_dmsf_keep_documents_locked) %> <%= check_box_tag 'settings[dmsf_keep_documents_locked]', '1', RedmineDmsf.dmsf_keep_documents_locked? %> - + <%= l(:note_dmsf_keep_documents_locked) %>
<%= l(:label_default)%>: <%= l(:general_text_No)%>
@@ -243,28 +233,25 @@

<%= 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? %> - + <%= l(:only_approval_zero_minor_version) %>
<%= l(:label_default) %>: <%= l(:general_text_No)%>


- + <%= 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]', options_for_select([ [l(:select_option_deactivated), '0'], [l(:select_option_activated), '1']], selected: RedmineDmsf.dmsf_webdav? ? '1' : '0'), - disabled: disabled, onchange: "$('#dmsf_webdav_block').toggle()" %> - + <% if disabled %> <% @settings['dmsf_webdav'] = '0' %> <%= l(:note_webdav_disabled) %> @@ -283,7 +270,7 @@ <% auth_types = [%w[Basic Basic], %w[Digest Digest]] %> <%= select_tag 'settings[dmsf_webdav_authentication]', options_for_select(auth_types, RedmineDmsf.dmsf_webdav_authentication) %> - + <%= l(:note_webdav_authentication) %>
<%= l(:label_default)%>: <%= auth_types[1][0] %>
@@ -296,7 +283,7 @@ [l(:select_option_webdav_readwrite), 'WEBDAV_READ_WRITE']], selected: RedmineDmsf.dmsf_webdav_strategy), onchange: "$('#dmsf_webdav_ro_block').toggle()" %>
- + <%= l(:note_webdav_strategy) %>
<%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %>
@@ -308,7 +295,7 @@

<%= content_tag(:label, l(:label_webdav_ignore)) %> <%= text_field_tag 'settings[dmsf_webdav_ignore]', RedmineDmsf.dmsf_webdav_ignore, size: 50 %> - + <%= l(:note_webdav_ignore) %> <%= l(:label_default) %>: ^(\._|\.DS_Store$|Thumbs.db$)

@@ -316,7 +303,7 @@ <%= content_tag(:label, l(:dmsf_webdav_ignore_1b_file_for_authentication)) %> <%= check_box_tag 'settings[dmsf_webdav_ignore_1b_file_for_authentication]', '1', RedmineDmsf.dmsf_webdav_ignore_1b_file_for_authentication? %> - + <%= l(:dmsf_webdav_ignore_1b_file_for_authentication_info) %>
<%= l(:label_default) %>: <%= l(:general_text_Yes) %>
@@ -325,7 +312,7 @@ <%= content_tag :label, l(:label_webdav_disable_versioning) %> <%= text_field_tag 'settings[dmsf_webdav_disable_versioning]', RedmineDmsf.dmsf_webdav_disable_versioning, size: 50 %> - + <%= l(:note_webdav_disable_versioning) %>
<%= l(:label_default) %>: ^\~\$|\.tmp$
@@ -333,7 +320,7 @@

<%= 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? %> - + <%= l(:note_webdav_use_project_names) %>
<%= l(:label_default)%>: <%= l(:general_text_No) %>
@@ -343,63 +330,56 @@


- - <%= l(:label_full_text) %> +

+ + <%= l(:text_fulltext_search, cmd1: 'libreoffice', cmd2: 'pdftotext') %> - -<% if defined?(EasyExtensions) %> +

+<% if RedmineDmsf::Plugin.lib_available?('xapian') %>

- - <%= l(:text_fulltext_search, cmd1: 'libreoffice', cmd2: 'pdftotext') %> + <%= content_tag :label, l(:label_index_database) %> + <%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %> + + <%= l(:label_default) %>: <%= File.expand_path('dmsf_index', Rails.root) %> + +

+ + <% stem_langs = %w(danish dutch english finnish french german hungarian italian norwegian portuguese romanian russian + spanish swedish turkish) %> + +

+ <%= content_tag :label, l(:label_stemming_language) %> + <%= select_tag 'settings[dmsf_stemming_lang]', options_for_select(stem_langs, RedmineDmsf.dmsf_stemming_lang) %> + + <%= l(:note_possible_values) %>: <%= stem_langs.join(', ') %>.
+ <%= "#{l(:label_default)}: #{stem_langs[2]}" %> +
+

+ +

+ <%= 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) %> +
+ <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', + RedmineDmsf.dmsf_stemming_strategy == 'STEM_SOME' %> <%= l(:option_stem_some) %> +
+ <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', + RedmineDmsf.dmsf_stemming_strategy == 'STEM_ALL' %> <%= l(:option_stem_all) %> +
+ + <%= l(:text_stemming_info) %> + +

+ +

+ <%= content_tag :label, l(:label_enable_cjk_ngrams) %> + <%= check_box_tag 'settings[dmsf_enable_cjk_ngrams]', '1', RedmineDmsf.dmsf_enable_cjk_ngrams? %> + + <%= l(:text_enable_cjk_ngrams) %>
+ <%= l(:label_default)%>: <%= l(:general_text_No) %>

<% else %> - <% if RedmineDmsf::Plugin.lib_available?('xapian') %> -

- <%= content_tag :label, l(:label_index_database) %> - <%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %> - - <%= l(:label_default) %>: <%= File.expand_path('dmsf_index', Rails.root) %> - -

- - <% stem_langs = %w(danish dutch english finnish french german hungarian italian norwegian portuguese romanian russian - spanish swedish turkish) %> - -

- <%= content_tag :label, l(:label_stemming_language) %> - <%= select_tag 'settings[dmsf_stemming_lang]', options_for_select(stem_langs, RedmineDmsf.dmsf_stemming_lang) %> - - <%= l(:note_possible_values) %>: <%= stem_langs.join(', ') %>.
- <%= "#{l(:label_default)}: #{stem_langs[2]}" %> -
-

- -

- <%= 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) %> -
- <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', - RedmineDmsf.dmsf_stemming_strategy == 'STEM_SOME' %> <%= l(:option_stem_some) %> -
- <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', - RedmineDmsf.dmsf_stemming_strategy == 'STEM_ALL' %> <%= l(:option_stem_all) %> -
- - <%= l(:text_stemming_info) %> - -

- -

- <%= content_tag :label, l(:label_enable_cjk_ngrams) %> - <%= check_box_tag 'settings[dmsf_enable_cjk_ngrams]', '1', RedmineDmsf.dmsf_enable_cjk_ngrams? %> - - <%= l(:text_enable_cjk_ngrams) %>
- <%= l(:label_default)%>: <%= l(:general_text_No) %> -
-

- <% else %> -

<%= l(:warning_xapian_not_available) %>

- <% end %> +

<%= l(:warning_xapian_not_available) %>

<% end %> diff --git a/assets/javascripts/attachments_dmsf.js b/assets/javascripts/attachments_dmsf.js index d3fc3f04..0e3fe97a 100644 --- a/assets/javascripts/attachments_dmsf.js +++ b/assets/javascripts/attachments_dmsf.js @@ -404,12 +404,4 @@ function dmsfSetupFileDrop() { } } -if(typeof EASY == "undefined"){ - $(document).ready(dmsfSetupFileDrop); -} -else { - EASY.schedule.late(function () { - dmsfSetupFileDrop(); - $(document).on("erui_new_dom", dmsfSetupFileDrop); - }); -} +$(document).ready(dmsfSetupFileDrop); diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css index a2c7f983..051201d2 100644 --- a/assets/stylesheets/redmine_dmsf.css +++ b/assets/stylesheets/redmine_dmsf.css @@ -31,13 +31,6 @@ a.dmsf-label { margin-left: 4px; } -/* Query form */ -.query-columns > span { /* EasyExtension */ - display: inline-block; - height: 100%; - vertical-align: middle; -} - /* Revision's downloads box */ #dmsf_buttons.dmsf-controls { float: left @@ -164,15 +157,6 @@ div#dmsf_new_revision { 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_"] { display: none; } diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 7790ae3d..b02b0401 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -82,7 +82,7 @@ hu: 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_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 label_email_from: Valakitől label_email_to: Valakinek diff --git a/config/locales/nl.yml b/config/locales/nl.yml index df58c1f0..1ed00e21 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -82,7 +82,7 @@ nl: title_lock_file: Vergrendel om wijzigingen door andere leden te voorkomen title_download_checked: Download aangevinkt in Zip archief 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 label_email_from: Van label_email_to: Aan @@ -178,7 +178,7 @@ nl: error_file_can_not_be_created: Bestand kan niet aangemaakt worden in opslag directory error_wrong_zip_encoding: Onjuiste Zip encoding warning_xapian_not_available: Xapian niet beschikbaar - menu_dmsf: Easy DMS + menu_dmsf: DMS label_physical_file_delete: Fysiek bestand verwijderen user_is_not_project_member: U bent geen lid van het project heading_access_downloads_emails: Downloads/E-mails @@ -187,7 +187,7 @@ nl: label_dmsf_updated: Bijgewerkt label_dmsf_downloaded: Gedownload 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 comment_copied_from: "Gekopieerd van %{source}" field_target_project: Doelproject diff --git a/config/routes.rb b/config/routes.rb index 3fb85fb4..2b3715fc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -168,11 +168,9 @@ if Redmine::Plugin.installed? 'redmine_dmsf' end # WebDAV workaround for clients checking WebDAV availability in the root - unless defined?(EasyExtensions) - match '/', - to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] }, - via: %i[propfind options] - end + match '/', + to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] }, + via: %i[propfind options] match '/dmsf', to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] }, via: %i[propfind options] diff --git a/db/migrate/04_dmsf_0_9_0.rb b/db/migrate/04_dmsf_0_9_0.rb index 3d48b023..a49f9d7c 100644 --- a/db/migrate/04_dmsf_0_9_0.rb +++ b/db/migrate/04_dmsf_0_9_0.rb @@ -20,12 +20,8 @@ # Add column class Dmsf090 < ActiveRecord::Migration[4.2] def up - if defined?(EasyExtensions) - add_column :members, :dmsf_mail_notification, :boolean, default: false - else - add_column :members, :dmsf_mail_notification, :boolean, - null: false, default: false - end + add_column :members, :dmsf_mail_notification, :boolean, + null: false, default: false drop_table :dmsf_user_prefs end diff --git a/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb b/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb index ed082866..ab03fb89 100644 --- a/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb +++ b/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb @@ -20,11 +20,7 @@ # Add column class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration[4.2] def change - if defined?(EasyExtensions) - add_column :custom_fields, :dmsf_not_inheritable, :boolean, default: false - else - add_column :custom_fields, :dmsf_not_inheritable, :boolean, - null: false, default: false - end + add_column :custom_fields, :dmsf_not_inheritable, :boolean, + null: false, default: false end end diff --git a/init.rb b/init.rb index c140253c..21c9e1a2 100644 --- a/init.rb +++ b/init.rb @@ -82,8 +82,6 @@ Redmine::MenuManager.map :project_menu do |menu| 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' }, diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index 58dc7326..07e91390 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -216,84 +216,59 @@ end # DMSF libraries -def after_easy_init(&block) - if defined?(EasyExtensions) - Rails.application.config.after_initialize(&block) - else - yield - end -end - # Validators -after_easy_init do - 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_workflow_name_validator" - require "#{File.dirname(__FILE__)}/../app/validators/dmsf_url_validator" - require "#{File.dirname(__FILE__)}/../app/validators/dmsf_folder_parent_validator" -end +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_workflow_name_validator" +require "#{File.dirname(__FILE__)}/../app/validators/dmsf_url_validator" +require "#{File.dirname(__FILE__)}/../app/validators/dmsf_folder_parent_validator" # Patches -unless defined?(EasyPatchManager) - require "#{File.dirname(__FILE__)}/../patches/formatting_helper_patch" - require "#{File.dirname(__FILE__)}/../patches/projects_helper_patch" - require "#{File.dirname(__FILE__)}/../patches/project_patch" - require "#{File.dirname(__FILE__)}/../patches/user_preference_patch" - require "#{File.dirname(__FILE__)}/../patches/user_patch" - require "#{File.dirname(__FILE__)}/../patches/issue_patch" - require "#{File.dirname(__FILE__)}/../patches/role_patch" - require "#{File.dirname(__FILE__)}/../patches/queries_controller_patch" - require "#{File.dirname(__FILE__)}/../patches/pdf_patch" - require "#{File.dirname(__FILE__)}/../patches/access_control_patch" - require "#{File.dirname(__FILE__)}/../patches/search_patch" - require "#{File.dirname(__FILE__)}/../patches/custom_field_patch" - require "#{File.dirname(__FILE__)}/../patches/puma_patch" - # A workaround for obsolete 'alias_method' usage in RedmineUp's plugins - if RedmineDmsf::Plugin.an_obsolete_plugin_present? - require "#{File.dirname(__FILE__)}/../patches/notifiable_ru_patch" - else - require "#{File.dirname(__FILE__)}/../patches/notifiable_patch" - end +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/formatting_helper_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/projects_helper_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/project_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/user_preference_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/user_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/issue_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/role_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/queries_controller_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/pdf_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/access_control_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/search_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/custom_field_patch" +require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/puma_patch" +# A workaround for obsolete 'alias_method' usage in RedmineUp's plugins +if RedmineDmsf::Plugin.an_obsolete_plugin_present? + require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/notifiable_ru_patch" +else + require "#{File.dirname(__FILE__)}/redmine_dmsf/patches/notifiable_patch" end # 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__)}/redmine_dmsf/webdav/custom_middleware" - 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/index_resource" - require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/project_resource" - require "#{File.dirname(__FILE__)}/redmine_dmsf/webdav/resource_proxy" -end +require "#{File.dirname(__FILE__)}/dav4rack" +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/dmsf_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/resource_proxy" # Hooks -def require_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/search_controller_hooks" - 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/custom_field_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/my_account_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/search_helper_hooks" - require "#{File.dirname(__FILE__)}/redmine_dmsf/hooks/helpers/project_helper_hooks" -end - -after_easy_init do - require_hooks -end +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/search_controller_hooks" +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/custom_field_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/my_account_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/project_helper_hooks" # Macros -after_easy_init do - require "#{File.dirname(__FILE__)}/redmine_dmsf/macros" -end +require "#{File.dirname(__FILE__)}/redmine_dmsf/macros" # Field formats -after_easy_init do - require "#{File.dirname(__FILE__)}/redmine_dmsf/field_formats/dmsf_file_revision_format" -end +require "#{File.dirname(__FILE__)}/redmine_dmsf/field_formats/dmsf_file_revision_format" diff --git a/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb b/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb index 675d7a59..c7da282c 100644 --- a/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb +++ b/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb @@ -53,12 +53,7 @@ module RedmineDmsf def controller_issues_bulk_edit_before_save(context = {}) controller_issues_before_save context # Call also the after safe hook, 'cause it's missing in Redmine - controller_issues_after_save(context, edit: true) unless defined?(EasyExtensions) - 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 + controller_issues_after_save(context, edit: true) end private diff --git a/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb b/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb deleted file mode 100644 index e4bda15c..00000000 --- a/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Document Management System "Features" -# -# Karel Pičman -# -# 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 -# . - -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 = +'

' - html << if context[:entity].dmsf_folder_id - context[:entity].class.human_attribute_name(:folder) - else - context[:entity].class.human_attribute_name(:project) - end - html << ':' - html << str - html << '

' - context[:additional_result] << html - end - end - end - end - end - end -end diff --git a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb index 8ef5d0a6..7b6e9b43 100644 --- a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb @@ -23,14 +23,12 @@ module RedmineDmsf # Base view hooks class BaseViewHooks < Redmine::Hook::ViewListener 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 ) return end - - partial = "hooks/#{defined?(EasyExtensions) ? 'easy' : 'redmine'}_dmsf/view_layouts_base_html_head" - context[:controller].send :render_to_string, { partial: partial } + context[:controller].send :render_to_string, { partial: 'hooks/redmine_dmsf/view_layouts_base_html_head' } end end end diff --git a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb index 68e4c0ce..f21a8903 100644 --- a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb @@ -26,8 +26,6 @@ module RedmineDmsf include DmsfFilesHelper def view_issues_form_details_bottom(context = {}) - return if defined?(EasyExtensions) - context[:container] = context[:issue] attach_documents_form(context) end @@ -36,7 +34,7 @@ module RedmineDmsf html = +'' container = context[:container] # Radio buttons - if allowed_to_attach_documents(container) && allowed_to_attach_attachments(container) + if allowed_to_attach_documents(container) html << '

' classes = +'inline' html << "' html << '

' 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();" ) end end # Upload form 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 end def view_issues_show_description_bottom(context = {}) - return if defined?(EasyExtensions) - show_attached_documents context[:issue], context[:controller] end @@ -101,7 +94,7 @@ module RedmineDmsf def view_issues_edit_notes_bottom_style(context = {}) 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 'display: none' @@ -120,14 +113,6 @@ module RedmineDmsf true 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) links = [] if defined?(container.dmsf_files) && @@ -165,8 +150,7 @@ module RedmineDmsf return unless allowed_to_attach_documents(container) html = +'' @@ -191,132 +175,9 @@ module RedmineDmsf links = get_links(container) return if links.blank? - if defined?(EasyExtensions) - attachment_rows links, container, controller - else - 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 = "#{l(:label_dmsf_attachments)} (#{links.count})" - links.each do |dmsf_file, link, _created_at| - html << attachment_row(dmsf_file, link, container, controller) - end - html << '' - html - end - - def attachment_row(dmsf_file, link, container, controller) - html = link ? +'' : +'' - # Checkbox - html << '' - file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file }) - # Title, size - html << '' - 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 << "(#{number_to_human_size(dmsf_file.last_revision.size)})" - if dmsf_file.description.present? - desc = clean_wiki_text(textilizable(dmsf_file.description)) - html << " - #{h(desc)}" - end - html << '' - # Author, updated at - html << '' - author = "#{h(dmsf_file.last_revision.user)}, #{format_time(dmsf_file.last_revision.updated_at)}" - html << "#{author}" - html << '' - # Command icons - html << '' - # 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 - '' - 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 << ('' * 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 << '' - html << '' - html + controller.send :render_to_string, + { partial: 'dmsf_files/links', + locals: { links: links, thumbnails: Setting.thumbnails_enabled? } } end end end diff --git a/patches/access_control_patch.rb b/lib/redmine_dmsf/patches/access_control_patch.rb similarity index 97% rename from patches/access_control_patch.rb rename to lib/redmine_dmsf/patches/access_control_patch.rb index 06999323..ab301974 100644 --- a/patches/access_control_patch.rb +++ b/lib/redmine_dmsf/patches/access_control_patch.rb @@ -43,4 +43,4 @@ module RedmineDmsf end # Apply the patch -Redmine::AccessControl.prepend RedmineDmsf::Patches::AccessControlPatch unless defined?(EasyPatchManager) +Redmine::AccessControl.prepend RedmineDmsf::Patches::AccessControlPatch diff --git a/patches/custom_field_patch.rb b/lib/redmine_dmsf/patches/custom_field_patch.rb similarity index 84% rename from patches/custom_field_patch.rb rename to lib/redmine_dmsf/patches/custom_field_patch.rb index 50fa2024..43223219 100644 --- a/patches/custom_field_patch.rb +++ b/lib/redmine_dmsf/patches/custom_field_patch.rb @@ -31,8 +31,4 @@ module RedmineDmsf end # Apply patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'CustomField', 'RedmineDmsf::Patches::CustomFieldPatch' -else - CustomField.include RedmineDmsf::Patches::CustomFieldPatch -end +CustomField.include RedmineDmsf::Patches::CustomFieldPatch diff --git a/patches/formatting_helper_patch.rb b/lib/redmine_dmsf/patches/formatting_helper_patch.rb similarity index 93% rename from patches/formatting_helper_patch.rb rename to lib/redmine_dmsf/patches/formatting_helper_patch.rb index a49c380a..7b7a403b 100644 --- a/patches/formatting_helper_patch.rb +++ b/lib/redmine_dmsf/patches/formatting_helper_patch.rb @@ -38,9 +38,8 @@ module RedmineDmsf '..', '..', '..', 'assets', 'javascripts', 'lang', "dmsf_button-#{lang}.js") lang = 'en' unless File.exist?(path) content_for :header_tags do - plugin = defined?(EasyExtensions) ? nil : :redmine_dmsf - javascript_include_tag("lang/dmsf_button-#{lang}", plugin: plugin) + - javascript_include_tag('dmsf_button', plugin: plugin) + + javascript_include_tag("lang/dmsf_button-#{lang}", plugin: :redmine_dmsf) + + javascript_include_tag('dmsf_button', plugin: :redmine_dmsf) + javascript_tag("jsToolBar.prototype.dmsfList = #{@dmsf_macro_list.to_json};") end end diff --git a/patches/issue_patch.rb b/lib/redmine_dmsf/patches/issue_patch.rb similarity index 96% rename from patches/issue_patch.rb rename to lib/redmine_dmsf/patches/issue_patch.rb index e5876f1a..86fad113 100644 --- a/patches/issue_patch.rb +++ b/lib/redmine_dmsf/patches/issue_patch.rb @@ -162,8 +162,4 @@ module RedmineDmsf end # Apply patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'Issue', 'RedmineDmsf::Patches::IssuePatch' -else - Issue.prepend RedmineDmsf::Patches::IssuePatch -end +Issue.prepend RedmineDmsf::Patches::IssuePatch diff --git a/patches/notifiable_patch.rb b/lib/redmine_dmsf/patches/notifiable_patch.rb similarity index 94% rename from patches/notifiable_patch.rb rename to lib/redmine_dmsf/patches/notifiable_patch.rb index f95fa2f6..e96b12e0 100644 --- a/patches/notifiable_patch.rb +++ b/lib/redmine_dmsf/patches/notifiable_patch.rb @@ -42,6 +42,6 @@ module RedmineDmsf end # 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 end diff --git a/patches/notifiable_ru_patch.rb b/lib/redmine_dmsf/patches/notifiable_ru_patch.rb similarity index 90% rename from patches/notifiable_ru_patch.rb rename to lib/redmine_dmsf/patches/notifiable_ru_patch.rb index d8d9eeb6..cda24969 100644 --- a/patches/notifiable_ru_patch.rb +++ b/lib/redmine_dmsf/patches/notifiable_ru_patch.rb @@ -46,8 +46,6 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_other_patch 'Redmine::Notifiable', 'RedmineDmsf::Patches::NotifiableRuPatch' -elsif RedmineDmsf::Plugin.an_obsolete_plugin_present? +if RedmineDmsf::Plugin.an_obsolete_plugin_present? Redmine::Notifiable.include RedmineDmsf::Patches::NotifiableRuPatch end diff --git a/patches/pdf_patch.rb b/lib/redmine_dmsf/patches/pdf_patch.rb similarity index 82% rename from patches/pdf_patch.rb rename to lib/redmine_dmsf/patches/pdf_patch.rb index f3163082..93e8084a 100644 --- a/patches/pdf_patch.rb +++ b/lib/redmine_dmsf/patches/pdf_patch.rb @@ -41,9 +41,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - 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 +Redmine::Export::PDF::ITCPDF.prepend RedmineDmsf::Patches::PdfPatch diff --git a/patches/project_patch.rb b/lib/redmine_dmsf/patches/project_patch.rb similarity index 96% rename from patches/project_patch.rb rename to lib/redmine_dmsf/patches/project_patch.rb index 2139d7f9..62a4d826 100644 --- a/patches/project_patch.rb +++ b/lib/redmine_dmsf/patches/project_patch.rb @@ -132,8 +132,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'Project', 'RedmineDmsf::Patches::ProjectPatch', prepend: true -else - Project.prepend RedmineDmsf::Patches::ProjectPatch -end +Project.prepend RedmineDmsf::Patches::ProjectPatch diff --git a/patches/projects_helper_patch.rb b/lib/redmine_dmsf/patches/projects_helper_patch.rb similarity index 97% rename from patches/projects_helper_patch.rb rename to lib/redmine_dmsf/patches/projects_helper_patch.rb index ffb7295c..7e999404 100644 --- a/patches/projects_helper_patch.rb +++ b/lib/redmine_dmsf/patches/projects_helper_patch.rb @@ -49,4 +49,4 @@ module RedmineDmsf end # Apply the patch -ProjectsController.send(:helper, RedmineDmsf::Patches::ProjectsHelperPatch) unless defined?(EasyPatchManager) +ProjectsController.send(:helper, RedmineDmsf::Patches::ProjectsHelperPatch) diff --git a/patches/puma_patch.rb b/lib/redmine_dmsf/patches/puma_patch.rb similarity index 94% rename from patches/puma_patch.rb rename to lib/redmine_dmsf/patches/puma_patch.rb index 71cb480a..ae99ac49 100644 --- a/patches/puma_patch.rb +++ b/lib/redmine_dmsf/patches/puma_patch.rb @@ -39,6 +39,6 @@ module RedmineDmsf end # 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 end diff --git a/patches/queries_controller_patch.rb b/lib/redmine_dmsf/patches/queries_controller_patch.rb similarity index 82% rename from patches/queries_controller_patch.rb rename to lib/redmine_dmsf/patches/queries_controller_patch.rb index 37d90fe9..3b2a3304 100644 --- a/patches/queries_controller_patch.rb +++ b/lib/redmine_dmsf/patches/queries_controller_patch.rb @@ -38,9 +38,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_controller_patch 'QueriesController', 'RedmineDmsf::Patches::QueriesControllerPatch', - prepend: true -else - QueriesController.prepend RedmineDmsf::Patches::QueriesControllerPatch -end +QueriesController.prepend RedmineDmsf::Patches::QueriesControllerPatch diff --git a/patches/role_patch.rb b/lib/redmine_dmsf/patches/role_patch.rb similarity index 88% rename from patches/role_patch.rb rename to lib/redmine_dmsf/patches/role_patch.rb index a95af4d8..e9d84492 100644 --- a/patches/role_patch.rb +++ b/lib/redmine_dmsf/patches/role_patch.rb @@ -41,8 +41,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'Role', 'RedmineDmsf::Patches::RolePatch', prepend: true -else - Role.prepend RedmineDmsf::Patches::RolePatch -end +Role.prepend RedmineDmsf::Patches::RolePatch diff --git a/patches/search_patch.rb b/lib/redmine_dmsf/patches/search_patch.rb similarity index 83% rename from patches/search_patch.rb rename to lib/redmine_dmsf/patches/search_patch.rb index 876fe152..c3eb24c0 100644 --- a/patches/search_patch.rb +++ b/lib/redmine_dmsf/patches/search_patch.rb @@ -43,9 +43,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - 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 +Redmine::Search.prepend RedmineDmsf::Patches::SearchPatch diff --git a/patches/user_patch.rb b/lib/redmine_dmsf/patches/user_patch.rb similarity index 94% rename from patches/user_patch.rb rename to lib/redmine_dmsf/patches/user_patch.rb index f49991e7..e6a997c8 100644 --- a/patches/user_patch.rb +++ b/lib/redmine_dmsf/patches/user_patch.rb @@ -62,8 +62,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'User', 'RedmineDmsf::Patches::UserPatch' -else - User.prepend RedmineDmsf::Patches::UserPatch -end +User.prepend RedmineDmsf::Patches::UserPatch diff --git a/patches/user_preference_patch.rb b/lib/redmine_dmsf/patches/user_preference_patch.rb similarity index 90% rename from patches/user_preference_patch.rb rename to lib/redmine_dmsf/patches/user_preference_patch.rb index e9b3eba4..67332a13 100644 --- a/patches/user_preference_patch.rb +++ b/lib/redmine_dmsf/patches/user_preference_patch.rb @@ -58,8 +58,4 @@ module RedmineDmsf end # Apply the patch -if defined?(EasyPatchManager) - EasyPatchManager.register_model_patch 'UserPreference', 'RedmineDmsf::Patches::UserPreferencePatch' -else - UserPreference.prepend RedmineDmsf::Patches::UserPreferencePatch -end +UserPreference.prepend RedmineDmsf::Patches::UserPreferencePatch diff --git a/lib/redmine_dmsf/plugin.rb b/lib/redmine_dmsf/plugin.rb index f3711d44..ffe5f2d9 100644 --- a/lib/redmine_dmsf/plugin.rb +++ b/lib/redmine_dmsf/plugin.rb @@ -30,8 +30,7 @@ module RedmineDmsf # present. # It is related especially to plugins made by AlphaNode and RedmineUP. def self.an_obsolete_plugin_present? - plugins = %w[easyproject/easy_plugins/easy_money redmine_questions redmine_db redmine_passwords redmine_resources - redmine_products redmine_finance] + plugins = %w[redmine_questions redmine_db redmine_passwords redmine_resources redmine_products redmine_finance] plugins.each do |plugin| return true if Plugin.present?(plugin) end diff --git a/lib/redmine_dmsf/webdav/dmsf_controller.rb b/lib/redmine_dmsf/webdav/dmsf_controller.rb index 06b21508..93b6074d 100644 --- a/lib/redmine_dmsf/webdav/dmsf_controller.rb +++ b/lib/redmine_dmsf/webdav/dmsf_controller.rb @@ -77,19 +77,11 @@ module RedmineDmsf raise Unauthorized end token = Token.find_by(user_id: user.id, action: 'dmsf_webdav_digest') - if token.nil? && defined?(EasyExtensions) - if user.easy_digest_token_expired? - Rails.logger.error "Digest authentication: #{user} is locked" - 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 + unless token + Rails.logger.error "Digest authentication: no digest found for #{username}" + raise Unauthorized end + ha1 = token.value ha2 = ActiveSupport::Digest.hexdigest("#{request.env['REQUEST_METHOD']}:#{uri}") required_response = if qop ActiveSupport::Digest.hexdigest("#{ha1}:#{nonce}:#{nc}:#{cnonce}:#{qop}:#{ha2}") diff --git a/patches/access_control_easy_patch.rb b/patches/access_control_easy_patch.rb deleted file mode 100644 index 39c291a5..00000000 --- a/patches/access_control_easy_patch.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Document Management System "Features" -# -# Karel Pičman -# -# 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 -# . - -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 diff --git a/patches/attachable_patch.rb b/patches/attachable_patch.rb deleted file mode 100644 index 95bb891c..00000000 --- a/patches/attachable_patch.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Document Management System "Features" -# -# Karel Pičman -# -# 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 -# . - -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 diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index 227cc4c5..d5a7b222 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -33,8 +33,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase @jsmith.pref.save! get '/my/page' assert_response :success - return if defined?(EasyExtensions) - assert_select 'div#list-top' do assert_select 'h3', { text: "#{l(:open_approvals)} (1)" } end @@ -46,8 +44,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase @jsmith.pref.save! get '/my/page' assert_response :success - return if defined?(EasyExtensions) - assert_select 'div#list-top' do assert_select 'h3', { text: "#{l(:open_approvals)} (0)" } end @@ -60,8 +56,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase @admin.pref.save! get '/my/page' assert_response :success - return if defined?(EasyExtensions) - text = l(:locked_documents) text << " (0 #{l(:label_number_of_folders).downcase} / 1 #{l(:label_number_of_documents).downcase})" assert_select 'div#list-top' do @@ -77,8 +71,6 @@ class MyControllerTest < RedmineDmsf::Test::TestCase @folder1.add_watcher @jsmith @project1.add_watcher @jsmith get '/my/page' - return if defined?(EasyExtensions) - assert_response :success assert_select 'div#list-top' do assert_select 'h3', { text: "#{l(:label_dmsf_watched)} (2/1)" } diff --git a/test/unit/lib/acccess_control_patch_test.rb b/test/unit/lib/acccess_control_patch_test.rb index bcc0760e..09727845 100644 --- a/test/unit/lib/acccess_control_patch_test.rb +++ b/test/unit/lib/acccess_control_patch_test.rb @@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__) class AccessControlPatchTest < RedmineDmsf::Test::UnitTest def test_available_project_modules 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 assert_not Redmine::AccessControl.available_project_modules.include?(:documents) end diff --git a/test/unit/lib/attachable_patch_test.rb b/test/unit/lib/attachable_patch_test.rb deleted file mode 100644 index 9a692e26..00000000 --- a/test/unit/lib/attachable_patch_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Document Management System "Features" -# -# Karel Pičman -# -# 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 -# . - -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 diff --git a/test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb b/test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb index 5f5f0443..55ce667f 100644 --- a/test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb +++ b/test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb @@ -31,20 +31,16 @@ class DmsfPluginTest < RedmineDmsf::Test::HelperTest end def test_an_obsolete_plugin_present_no - return if defined?(EasyExtensions) - # No such plugin is present assert_not RedmineDmsf::Plugin.an_obsolete_plugin_present? end def test_an_obsolete_plugin_present_yes - unless defined?(EasyExtensions) - # Create a fake redmine_checklists plugin - path = Rails.root.join('plugins/redmine_resources') - FileUtils.mkdir_p path - end + # Create a fake redmine_checklists plugin + path = Rails.root.join('plugins/redmine_resources') + FileUtils.mkdir_p path assert RedmineDmsf::Plugin.an_obsolete_plugin_present? - FileUtils.rm_rf(path) unless defined?(EasyExtensions) + FileUtils.rm_rf path end def test_lib_available? diff --git a/test/unit/lib/search_patch_test.rb b/test/unit/lib/search_patch_test.rb index 030f8bea..2ae83036 100644 --- a/test/unit/lib/search_patch_test.rb +++ b/test/unit/lib/search_patch_test.rb @@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__) class SearchPatchTest < RedmineDmsf::Test::UnitTest def test_available_search_types 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 assert_not Redmine::Search.available_search_types.include?('documents') end diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index 52e79ab9..1ddad4f1 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -36,9 +36,6 @@ class UserPatchTest < RedmineDmsf::Test::UnitTest 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(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, DmsfLock.where(user_id: id).all.size assert_equal 0, DmsfWorkflowStepAction.where(author_id: id).all.size