Removal of unnnecessary files
This commit is contained in:
parent
1d5a89b65b
commit
fac307354d
@ -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:
|
||||
|
||||
4
Gemfile
4
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
|
||||
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'
|
||||
|
||||
155
after_init.rb
155
after_init.rb
@ -1,155 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Vít Jonáš <vit.jonas@gmail.com>, Daniel Munn <dan.munn@munnster.co.uk>, Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This file is part of Redmine DMSF plugin.
|
||||
#
|
||||
# Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
require 'redmine'
|
||||
require 'zip'
|
||||
require "#{File.dirname(__FILE__)}/lib/redmine_dmsf"
|
||||
|
||||
def dmsf_init
|
||||
# Administration menu extension
|
||||
Redmine::MenuManager.map :admin_menu do |menu|
|
||||
menu.push :dmsf_approvalworkflows, :dmsf_workflows_path,
|
||||
caption: :label_dmsf_workflow_plural,
|
||||
icon: 'workflows',
|
||||
html: { class: 'icon icon-workflows' },
|
||||
if: proc { |_| User.current.admin? }
|
||||
end
|
||||
# Project menu extension
|
||||
Redmine::MenuManager.map :project_menu do |menu|
|
||||
menu.push :dmsf, { controller: 'dmsf', action: 'show' },
|
||||
caption: :menu_dmsf,
|
||||
before: :documents,
|
||||
param: :id,
|
||||
html: { class: 'icon icon-dmsf' }
|
||||
# New menu extension
|
||||
next if defined?(EasyExtensions)
|
||||
|
||||
menu.push :dmsf_file, { controller: 'dmsf_upload', action: 'multi_upload' },
|
||||
caption: :label_dmsf_new_top_level_document, parent: :new_object
|
||||
menu.push :dmsf_folder, { controller: 'dmsf', action: 'new' },
|
||||
caption: :label_dmsf_new_top_level_folder,
|
||||
parent: :new_object
|
||||
end
|
||||
# Main menu extension
|
||||
Redmine::MenuManager.map :top_menu do |menu|
|
||||
menu.push :dmsf, { controller: 'dmsf', action: 'index' },
|
||||
caption: :menu_dmsf,
|
||||
html: { class: 'icon-dmsf', category: :rest_extension_modules },
|
||||
if: proc {
|
||||
User.current.allowed_to?(:view_dmsf_folders, nil, global: true) &&
|
||||
ActiveRecord::Base.connection.data_source_exists?('settings') &&
|
||||
!RedmineDmsf.dmsf_global_menu_disabled?
|
||||
}
|
||||
end
|
||||
|
||||
Redmine::AccessControl.map do |map|
|
||||
map.project_module :dmsf do |pmap|
|
||||
pmap.permission :view_dmsf_file_revision_accesses, {}, read: true
|
||||
pmap.permission :view_dmsf_file_revisions, {}, read: true
|
||||
pmap.permission :view_dmsf_folders, { dmsf: %i[show index] }, read: true
|
||||
pmap.permission :user_preferences, { dmsf_state: [:user_pref_save] }, require: :member
|
||||
pmap.permission(:view_dmsf_files,
|
||||
{ dmsf: %i[entries_operation entries_email download_email_entries add_email append_email
|
||||
autocomplete_for_user],
|
||||
dmsf_files: %i[show view thumbnail],
|
||||
dmsf_workflows: [:log] },
|
||||
read: true)
|
||||
pmap.permission :email_documents,
|
||||
{ dmsf_public_urls: [:create] }
|
||||
pmap.permission :folder_manipulation,
|
||||
{ dmsf: %i[new create delete edit save edit_root save_root lock unlock notify_activate
|
||||
notify_deactivate restore drop copymove],
|
||||
dmsf_folder_permissions: %i[new append autocomplete_for_user],
|
||||
dmsf_context_menus: [:dmsf] }
|
||||
pmap.permission :file_manipulation,
|
||||
{ dmsf_files: %i[create_revision lock unlock delete_revision obsolete_revision
|
||||
notify_activate notify_deactivate restore],
|
||||
dmsf_upload: %i[upload_files upload commit_files commit delete_dmsf_attachment
|
||||
delete_dmsf_link_attachment multi_upload],
|
||||
dmsf_links: %i[new create destroy restore autocomplete_for_project autocomplete_for_folder],
|
||||
dmsf_context_menus: [:dmsf] }
|
||||
pmap.permission :file_delete,
|
||||
{ dmsf: %i[trash delete_entries empty_trash],
|
||||
dmsf_files: [:delete],
|
||||
dmsf_trash_context_menus: [:trash] }
|
||||
pmap.permission :force_file_unlock, {}
|
||||
pmap.permission :file_approval,
|
||||
{ dmsf_workflows: %i[action new_action autocomplete_for_user start assign assignment] }
|
||||
pmap.permission :manage_workflows,
|
||||
{ dmsf_workflows: %i[index new create destroy show new_step add_step remove_step
|
||||
reorder_steps update update_step delete_step edit] }
|
||||
pmap.permission :display_system_folders, {}, read: true
|
||||
# Watchers
|
||||
pmap.permission :view_dmsf_file_watchers, {}, read: true
|
||||
pmap.permission :add_dmsf_file_watchers, { watchers: %i[new create append autocomplete_for_user] }
|
||||
pmap.permission :delete_dmsf_file_watchers, { watchers: :destroy }
|
||||
pmap.permission :view_dmsf_folder_watchers, {}, read: true
|
||||
pmap.permission :add_dmsf_folder_watchers, { watchers: %i[new create append autocomplete_for_user] }
|
||||
pmap.permission :delete_dmsf_folder_watchers, { watchers: :destroy }
|
||||
pmap.permission :view_project_watchers, {}, read: true
|
||||
pmap.permission :add_project_watchers, { watchers: %i[new create append autocomplete_for_user] }
|
||||
pmap.permission :delete_project_watchers, { watchers: :destroy }
|
||||
end
|
||||
end
|
||||
# DMSF WebDAV digest token
|
||||
Token.add_action :dmsf_webdav_digest, max_instances: 1, validity_time: nil
|
||||
end
|
||||
|
||||
if defined?(EasyExtensions)
|
||||
Rails.application.config.after_initialize do
|
||||
dmsf_init
|
||||
|
||||
# Register panels for My page
|
||||
EpmDmsfLockedDocuments.register_to_scope :user, plugin: :redmine_dmsf
|
||||
EpmDmsfOpenApprovals.register_to_scope :user, plugin: :redmine_dmsf
|
||||
EpmDmsfWatchedDocuments.register_to_scope :user, plugin: :redmine_dmsf
|
||||
end
|
||||
else
|
||||
dmsf_init
|
||||
end
|
||||
|
||||
Rails.application.configure do
|
||||
# Rubyzip configuration
|
||||
Zip.unicode_names = true
|
||||
|
||||
# DMS custom fields
|
||||
after_easy_init do
|
||||
CustomFieldsHelper::CUSTOM_FIELDS_TABS << { name: 'DmsfFileRevisionCustomField', partial: 'custom_fields/index',
|
||||
label: :dmsf }
|
||||
end
|
||||
|
||||
# Searchable modules
|
||||
after_easy_init do
|
||||
Redmine::Search.map do |search|
|
||||
search.register :dmsf_files
|
||||
search.register :dmsf_folders
|
||||
end
|
||||
end
|
||||
|
||||
# Activities
|
||||
after_easy_init do
|
||||
Redmine::Activity.register :dmsf_file_revision_accesses, default: false
|
||||
Redmine::Activity.register :dmsf_file_revisions
|
||||
end
|
||||
|
||||
if defined?(EasyExtensions)
|
||||
require "#{File.dirname(__FILE__)}/lib/redmine_dmsf/webdav/custom_middleware"
|
||||
config.middleware.insert_before ActionDispatch::Cookies, RedmineDmsf::Webdav::CustomMiddleware
|
||||
end
|
||||
end
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 %>
|
||||
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||||
<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
|
||||
<%= javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
|
||||
controller: 'dmsf', action: 'autocomplete_for_user') }')" %>
|
||||
<div id="users_for_watcher">
|
||||
<%= render_principals_for_new_email @principals %>
|
||||
|
||||
@ -31,17 +31,6 @@
|
||||
class: 'icon icon-add', data: { cy: 'button__create-folder--dmsf' } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if defined?(EasyExtensions) %>
|
||||
<%= 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 } %>
|
||||
<% else %>
|
||||
<%= actions_dropdown do %>
|
||||
<%= render partial: 'dmsf_context_menus/main', locals: {
|
||||
folder_manipulation_allowed: @folder_manipulation_allowed,
|
||||
@ -53,7 +42,6 @@
|
||||
trash_enabled: @trash_enabled,
|
||||
notifications: @notifications} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% 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 %>
|
||||
@ -27,15 +27,9 @@
|
||||
<table class="list dmsf odd-even <%= query.css_classes %> context-menu-container" data-hascontextmenu="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<% 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 %>
|
||||
<th class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
|
||||
</th>
|
||||
<% end %>
|
||||
<% query.inline_columns.each do |column| %>
|
||||
<%= column_header(query, column, query_options) %>
|
||||
<% end %>
|
||||
|
||||
@ -46,20 +46,14 @@
|
||||
<% end %>
|
||||
<td class="buttons">
|
||||
<% 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 %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% 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({
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
<%= javascript_tag do %>
|
||||
$('#move_button').click(function(event) {
|
||||
$('input#copy_entries').remove()
|
||||
});
|
||||
|
||||
@ -33,21 +33,6 @@
|
||||
back_url: edit_dmsf_url(id: @project, folder_id: @folder)),
|
||||
title: l(:title_lock_file), class: 'icon icon-lock' %>
|
||||
<% end %>
|
||||
<% if defined?(EasyExtensions) %>
|
||||
<%= 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)
|
||||
} %>
|
||||
<% else %>
|
||||
<%= actions_dropdown do %>
|
||||
<%= render partial: 'dmsf_context_menus/folder',
|
||||
locals: { dmsf_folder: @folder,
|
||||
@ -64,7 +49,6 @@
|
||||
} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% create = @pathfolder == @parent %>
|
||||
|
||||
@ -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 %>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
<%= javascript_tag do %>
|
||||
$('#dmsf-cm-delete').click(function (event) {
|
||||
$('#context-menu').hide();
|
||||
});
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
allowed_restore: @allowed_restore }) %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= late_javascript_tag do %>
|
||||
<%= javascript_tag do %>
|
||||
$('#dmsf-cm-delete').click(function (event) {
|
||||
$('#context-menu').hide();
|
||||
});
|
||||
|
||||
@ -37,11 +37,6 @@
|
||||
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) %>
|
||||
<%= 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,
|
||||
@ -49,7 +44,6 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render partial: '/dmsf/path', locals: { folder: @file.dmsf_folder, filename: @file.title, title: nil } %>
|
||||
@ -72,17 +66,11 @@
|
||||
<div class="dmsf-revision-box">
|
||||
<div class="dmsf-widget-header fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix">
|
||||
<div class="dmsf-controls contextual">
|
||||
<% if defined?(EasyExtensions) %>
|
||||
<%= 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 %>
|
||||
</div>
|
||||
<div class="dmsf-widget-header-text">
|
||||
<i><%= l(:info_revision, rev: revision.id) %></i>
|
||||
@ -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();
|
||||
|
||||
@ -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 %>
|
||||
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||||
<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
|
||||
<%= javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for(
|
||||
controller: 'dmsf_folder_permissions', action: 'autocomplete_for_user', project_id: @project,
|
||||
dmsf_folder_id: @dmsf_folder) }')" %>
|
||||
<div id="users_for_watcher">
|
||||
|
||||
@ -4,8 +4,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Wiki formatting</title>
|
||||
<%= 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 %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@ -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 @@
|
||||
</div>
|
||||
</div>
|
||||
<% 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 %>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
<div>
|
||||
<%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %><br>
|
||||
<%= text_field_tag 'user_search', nil %>
|
||||
<%= late_javascript_tag "observeSearchfield('user_search', null, '#{escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: params[:dmsf_workflow_step_assignment_id], dmsf_file_revision_id: params[:dmsf_file_revision_id])}')" %>
|
||||
<%= javascript_tag "observeSearchfield('user_search', null, '#{escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: params[:dmsf_workflow_step_assignment_id], dmsf_file_revision_id: params[:dmsf_file_revision_id])}')" %>
|
||||
<div id="dmsf_users_for_delegate">
|
||||
<%= render_principals_for_new_dmsf_workflow_users(
|
||||
@dmsf_workflow, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id]) %>
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<fieldset class="box">
|
||||
<legend><%= l(:label_dmsf_workflow_add_approver) %></legend>
|
||||
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||||
<%= late_javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: nil, dmsf_file_revision_id: nil, project_id: @project ? @project.id : nil) }')" %>
|
||||
<%= javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, dmsf_workflow_step_assignment_id: nil, dmsf_file_revision_id: nil, project_id: @project ? @project.id : nil) }')" %>
|
||||
<div id="dmsf_users_for_delegate">
|
||||
<%= render_principals_for_new_dmsf_workflow_users @dmsf_workflow %>
|
||||
</div>
|
||||
|
||||
@ -133,6 +133,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
<%= javascript_tag do %>
|
||||
$(function() { $("table.steps tbody").positionedItems(); });
|
||||
<% end %>
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<% 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());
|
||||
});
|
||||
|
||||
@ -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 %>
|
||||
<h3>
|
||||
<%= l(:locked_documents)%> (<%= "#{folders.all.size} #{l(:label_number_of_folders).downcase}" %> / <%= "#{files.all.size} #{l(:label_number_of_documents).downcase}" %>)
|
||||
</h3>
|
||||
<% end %>
|
||||
<% if folders.any? || files.any?%>
|
||||
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
|
||||
<%= hidden_field_tag 'back_url', my_page_path, id: nil %>
|
||||
<table class="list context-menu-container" data-hascontextmenu="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<% unless easy_extension %>
|
||||
<th class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
|
||||
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
|
||||
</th>
|
||||
<% end %>
|
||||
<th><%= l(:field_project) %></th>
|
||||
<th><%= l(:label_document) %>/<%= l(:field_folder) %></th>
|
||||
<th><%= l(:field_folder) %></th>
|
||||
<% unless easy_extension %>
|
||||
<th></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% folders.each do |folder| %>
|
||||
<tr id="folder-<%= folder.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<%= link_to_project folder.project %>
|
||||
</td>
|
||||
@ -76,20 +64,16 @@
|
||||
<%= link_to l(:link_documents), dmsf_folder_path(id: folder.project) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% unless easy_extension %>
|
||||
<td class="buttons">
|
||||
<%= link_to_context_menu %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% files.each do |file| %>
|
||||
<tr id="file-<%= file.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<%= link_to_project file.project %>
|
||||
</td>
|
||||
@ -104,17 +88,15 @@
|
||||
<%= link_to_if file.project, l(:link_documents), dmsf_folder_path(id: file.project) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% unless easy_extension %>
|
||||
<td class="buttons">
|
||||
<%= link_to_context_menu %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= context_menu unless easy_extension %>
|
||||
<%= context_menu %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
@ -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 %>
|
||||
<h3><%= l(:open_approvals)%> (<%= assignments.size %>)</h3>
|
||||
<% end %>
|
||||
<h3><%= l(:open_approvals)%> (<%= assignments.size %>)</h3>
|
||||
<% if assignments.any? %>
|
||||
<%= form_tag({}, data: { cm_url: dmsf_context_menu_path }) do %>
|
||||
<%= hidden_field_tag 'back_url', my_page_path, id: nil %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<% unless easy_extension %>
|
||||
<th class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
|
||||
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
|
||||
</th>
|
||||
<% end %>
|
||||
<th><%= l(:field_project) %></th>
|
||||
<th><%= l(:field_label_dmsf_workflow) %></th>
|
||||
<th><%= l(:field_status) %></th>
|
||||
<th><%= l(:label_document) %></th>
|
||||
<th><%= l(:field_folder) %></th>
|
||||
<% unless easy_extension %>
|
||||
<th></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% assignments.each do |assignment| %>
|
||||
<tr id="file-<%= assignment.dmsf_file_revision.dmsf_file.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "file-#{assignment.dmsf_file_revision.dmsf_file.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<% if assignment.dmsf_file_revision.dmsf_file.project %>
|
||||
<%= link_to_project assignment.dmsf_file_revision.dmsf_file.project %>
|
||||
@ -105,17 +96,15 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% unless easy_extension %>
|
||||
<td class="buttons">
|
||||
<%= link_to_context_menu %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= context_menu unless easy_extension %>
|
||||
<%= context_menu %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
@ -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 %>
|
||||
<h3><%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)</h3>
|
||||
<% end %>
|
||||
<h3><%= l(:label_dmsf_watched)%> (<%= projects.all.size + folders.all.size %>/<%= files.all.size %>)</h3>
|
||||
<% 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 %>
|
||||
<table class="list context-menu-container" data-hascontextmenu="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<% unless easy_extension %>
|
||||
<th class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
|
||||
title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
|
||||
</th>
|
||||
<% end %>
|
||||
<th><%= l(:field_project) %></th>
|
||||
<th><%= l(:label_document) %>/<%= l(:field_folder) %></th>
|
||||
<th><%= l(:field_folder) %></th>
|
||||
<% unless easy_extension %>
|
||||
<th></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% projects.each do |project| %>
|
||||
<tr id="project-<%= project.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "project-#{project.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<%= link_to_project project %>
|
||||
</td>
|
||||
@ -71,11 +62,9 @@
|
||||
<% end %>
|
||||
<% folders.each do |folder| %>
|
||||
<tr id="folder-<%= folder.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "folder-#{folder.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<%= link_to_project folder.project %>
|
||||
</td>
|
||||
@ -98,11 +87,9 @@
|
||||
<% end %>
|
||||
<% files.each do |file| %>
|
||||
<tr id="file-<%= file.id %>" class="hascontextmenu">
|
||||
<% unless easy_extension %>
|
||||
<td class="checkbox hide-when-print">
|
||||
<%= check_box_tag 'ids[]', "file-#{file.id}", false, id: nil %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="project">
|
||||
<%= link_to_project(file.project) if file.project %>
|
||||
</td>
|
||||
@ -117,17 +104,15 @@
|
||||
<%= link_to l(:link_documents), dmsf_folder_path(id: file.project) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% unless easy_extension %>
|
||||
<td class="buttons">
|
||||
<%= link_to_context_menu %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= context_menu unless easy_extension %>
|
||||
<%= context_menu %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
@ -17,24 +17,14 @@
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<%
|
||||
if defined?(EasyExtensions)
|
||||
klass = 'small dmsf-info'
|
||||
title_klass = 'small dmsf-info dmsf-info-title'
|
||||
else
|
||||
klass = 'info';
|
||||
title_klass = 'info'
|
||||
end
|
||||
%>
|
||||
|
||||
<em class="<%= title_klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_general) %>
|
||||
</em>
|
||||
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_maximum_files_download) %>
|
||||
<%= text_field_tag 'settings[dmsf_max_file_download]', RedmineDmsf.dmsf_max_file_download, size: 10 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_maximum_number_of_files_downloaded) %><br>
|
||||
<%= l(:label_default) %>: 0
|
||||
</em>
|
||||
@ -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 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_max_notification_receivers_info) %><br>
|
||||
<%= l(:label_default) %>: 10
|
||||
</em>
|
||||
@ -53,7 +43,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_maximum_email_filesize) %>
|
||||
<%= text_field_tag 'settings[dmsf_max_email_filesize]', RedmineDmsf.dmsf_max_email_filesize, size: 10 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_maximum_email_filesize) %><br>
|
||||
<%= l(:label_default) %>: 0
|
||||
</em>
|
||||
@ -62,7 +52,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_file_storage_directory) %>
|
||||
<%= text_field_tag 'settings[dmsf_storage_directory]', RedmineDmsf.dmsf_storage_directory, size: 256 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: files/dmsf
|
||||
</em>
|
||||
</p>
|
||||
@ -92,7 +82,7 @@
|
||||
<small><%= l(:note_dmsf_office_bin_not_available, RedmineDmsf.office_bin ||= 'libreoffice') %></small>
|
||||
</span>
|
||||
<% end %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_office_bin) %><br>
|
||||
<%= l(:label_default) %>: 'libreoffice'
|
||||
</em>
|
||||
@ -101,7 +91,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_physical_file_delete) %>
|
||||
<%= check_box_tag 'settings[dmsf_really_delete_files]', '1', RedmineDmsf.physical_file_delete? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No)%>
|
||||
</em>
|
||||
</p>
|
||||
@ -113,7 +103,7 @@
|
||||
[l(:select_option_deactivated), '0'],
|
||||
[l(:select_option_activated), '1']],
|
||||
selected: RedmineDmsf.dmsf_default_notifications? ? '1' : '0') %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= l(:select_option_deactivated) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -125,7 +115,7 @@
|
||||
[l(:select_option_deactivated), '0'],
|
||||
[l(:select_option_activated), '1']],
|
||||
selected: RedmineDmsf.dmsf_display_notified_recipients? ? '1' : '0') %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_display_notified_recipients) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:select_option_deactivated) %>
|
||||
</em>
|
||||
@ -134,7 +124,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_title_format) %>
|
||||
<%= text_field_tag 'settings[dmsf_global_title_format]', RedmineDmsf.dmsf_global_title_format, size: 10 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:text_title_format) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -142,7 +132,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_act_as_attachable) %>
|
||||
<%= check_box_tag 'settings[dmsf_act_as_attachable]', '1', RedmineDmsf.dmsf_act_as_attachable? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_act_as_attachable) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
@ -151,7 +141,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_dmsf_projects_as_subfolders) %>
|
||||
<%= check_box_tag 'settings[dmsf_projects_as_subfolders]', '1', RedmineDmsf.dmsf_projects_as_subfolders? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_projects_as_subfolders) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
@ -160,7 +150,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_dmsf_global_menu_disabled) %>
|
||||
<%= check_box_tag 'settings[dmsf_global_menu_disabled]', '1', RedmineDmsf.dmsf_global_menu_disabled? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_global_menu_disabled) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
@ -169,7 +159,7 @@
|
||||
<p>
|
||||
<%= 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? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -177,13 +167,13 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_remove_original_documents_module) %>
|
||||
<%= check_box_tag 'settings[remove_original_documents_module]', '1', RedmineDmsf.remove_original_documents_module? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<em class="<%= title_klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_dmsf_columns) %>
|
||||
</em>
|
||||
|
||||
@ -198,14 +188,14 @@
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<em class="<%= title_klass %>">
|
||||
<em class="info">
|
||||
<%= l(:heading_send_documents_by_email) %>
|
||||
</em>
|
||||
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_email_from_override) %>
|
||||
<%= text_field_tag 'settings[dmsf_documents_email_from]', RedmineDmsf.dmsf_documents_email_from, size: 128 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= l(:text_email_from_override) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -213,7 +203,7 @@
|
||||
<p>
|
||||
<%= 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 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= "''" %>
|
||||
</em>
|
||||
</p>
|
||||
@ -221,20 +211,20 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_links_only).capitalize %>
|
||||
<%= check_box_tag 'settings[dmsf_documents_email_links_only]', '1', RedmineDmsf.dmsf_documents_email_links_only? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<em class="<%= title_klass %>">
|
||||
<em class="info">
|
||||
<%= l(:field_label_dmsf_workflow) %>
|
||||
</em>
|
||||
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_dmsf_keep_documents_locked) %>
|
||||
<%= check_box_tag 'settings[dmsf_keep_documents_locked]', '1', RedmineDmsf.dmsf_keep_documents_locked? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_dmsf_keep_documents_locked) %><br>
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No)%>
|
||||
</em>
|
||||
@ -243,28 +233,25 @@
|
||||
<p>
|
||||
<%= 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? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:only_approval_zero_minor_version) %><br> <%= l(:label_default) %>: <%= l(:general_text_No)%>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<em class="<%= title_klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_webdav) %>
|
||||
</em>
|
||||
|
||||
<p>
|
||||
<%= 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()" %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<% 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) %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_authentication) %><br>
|
||||
<%= l(:label_default)%>: <%= auth_types[1][0] %>
|
||||
</em>
|
||||
@ -296,7 +283,7 @@
|
||||
[l(:select_option_webdav_readwrite), 'WEBDAV_READ_WRITE']],
|
||||
selected: RedmineDmsf.dmsf_webdav_strategy),
|
||||
onchange: "$('#dmsf_webdav_ro_block').toggle()" %><br>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_strategy) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %>
|
||||
</em>
|
||||
@ -308,7 +295,7 @@
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_webdav_ignore)) %>
|
||||
<%= text_field_tag 'settings[dmsf_webdav_ignore]', RedmineDmsf.dmsf_webdav_ignore, size: 50 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_ignore) %> <%= l(:label_default) %>: ^(\._|\.DS_Store$|Thumbs.db$)
|
||||
</em>
|
||||
</p>
|
||||
@ -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? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:dmsf_webdav_ignore_1b_file_for_authentication_info) %><br>
|
||||
<%= l(:label_default) %>: <%= l(:general_text_Yes) %>
|
||||
</em>
|
||||
@ -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 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_disable_versioning) %><br>
|
||||
<%= l(:label_default) %>: ^\~\$|\.tmp$
|
||||
</em>
|
||||
@ -333,7 +320,7 @@
|
||||
<p>
|
||||
<%= 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? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_use_project_names) %><br>
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
@ -343,22 +330,16 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<em class="<%= title_klass %>">
|
||||
<%= l(:label_full_text) %>
|
||||
</em>
|
||||
|
||||
<% if defined?(EasyExtensions) %>
|
||||
<p>
|
||||
<em class="<%= klass %>">
|
||||
<p>
|
||||
<em class="info">
|
||||
<%= l(:text_fulltext_search, cmd1: 'libreoffice', cmd2: 'pdftotext') %>
|
||||
</em>
|
||||
</p>
|
||||
<% else %>
|
||||
<% if RedmineDmsf::Plugin.lib_available?('xapian') %>
|
||||
</em>
|
||||
</p>
|
||||
<% if RedmineDmsf::Plugin.lib_available?('xapian') %>
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_index_database) %>
|
||||
<%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:label_default) %>: <%= File.expand_path('dmsf_index', Rails.root) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -369,7 +350,7 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_stemming_language) %>
|
||||
<%= select_tag 'settings[dmsf_stemming_lang]', options_for_select(stem_langs, RedmineDmsf.dmsf_stemming_lang) %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:note_possible_values) %>: <%= stem_langs.join(', ') %>.<br>
|
||||
<%= "#{l(:label_default)}: #{stem_langs[2]}" %>
|
||||
</em>
|
||||
@ -386,7 +367,7 @@
|
||||
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL',
|
||||
RedmineDmsf.dmsf_stemming_strategy == 'STEM_ALL' %> <%= l(:option_stem_all) %>
|
||||
<br>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:text_stemming_info) %>
|
||||
</em>
|
||||
</p>
|
||||
@ -394,12 +375,11 @@
|
||||
<p>
|
||||
<%= content_tag :label, l(:label_enable_cjk_ngrams) %>
|
||||
<%= check_box_tag 'settings[dmsf_enable_cjk_ngrams]', '1', RedmineDmsf.dmsf_enable_cjk_ngrams? %>
|
||||
<em class="<%= klass %>">
|
||||
<em class="info">
|
||||
<%= l(:text_enable_cjk_ngrams) %><br>
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No) %>
|
||||
</em>
|
||||
</p>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<p class="warning"><%= l(:warning_xapian_not_available) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 '/dmsf',
|
||||
to: ->(env) { [405, {}, ["#{env['REQUEST_METHOD']} method is not allowed"]] },
|
||||
via: %i[propfind options]
|
||||
|
||||
@ -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
|
||||
drop_table :dmsf_user_prefs
|
||||
end
|
||||
|
||||
|
||||
@ -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
|
||||
end
|
||||
end
|
||||
|
||||
2
init.rb
2
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' },
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This file is part of Redmine DMSF plugin.
|
||||
#
|
||||
# Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
module RedmineDmsf
|
||||
module Hooks
|
||||
module Helpers
|
||||
# Search helper hooks
|
||||
class SearchHelperHooks < Redmine::Hook::Listener
|
||||
def helper_easy_extensions_search_helper_patch(context = {})
|
||||
case context[:entity].event_type
|
||||
when 'dmsf-file', 'dmsf-folder'
|
||||
str = context[:controller].send(:render_to_string,
|
||||
partial: 'search/container',
|
||||
locals: { object: context[:entity] })
|
||||
if str
|
||||
html = +'<p class=\"file-detail-container\"><span><strong>'
|
||||
html << if context[:entity].dmsf_folder_id
|
||||
context[:entity].class.human_attribute_name(:folder)
|
||||
else
|
||||
context[:entity].class.human_attribute_name(:project)
|
||||
end
|
||||
html << ':</strong>'
|
||||
html << str
|
||||
html << '</span></p>'
|
||||
context[:additional_result] << html
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -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
|
||||
|
||||
@ -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 << '<p>'
|
||||
classes = +'inline'
|
||||
html << "<label class=\"#{classes}\">"
|
||||
@ -60,22 +58,17 @@ module RedmineDmsf
|
||||
html << '</label>'
|
||||
html << '</p>'
|
||||
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 = +'<p'
|
||||
if User.current.pref.dmsf_attachments_upload_choice == 'Attachments' &&
|
||||
allowed_to_attach_attachments(container)
|
||||
if User.current.pref.dmsf_attachments_upload_choice == 'Attachments'
|
||||
html << ' style="display: none;"'
|
||||
end
|
||||
html << '>'
|
||||
@ -191,134 +175,11 @@ 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 = "<tbody><tr><th colspan=\"4\">#{l(:label_dmsf_attachments)} (#{links.count})</th></tr>"
|
||||
links.each do |dmsf_file, link, _created_at|
|
||||
html << attachment_row(dmsf_file, link, container, controller)
|
||||
end
|
||||
html << '</tbody>'
|
||||
html
|
||||
end
|
||||
|
||||
def attachment_row(dmsf_file, link, container, controller)
|
||||
html = link ? +'<tr class="dmsf-gray">' : +'<tr>'
|
||||
# Checkbox
|
||||
html << '<td></td>'
|
||||
file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file })
|
||||
# Title, size
|
||||
html << '<td>'
|
||||
data = "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}"
|
||||
icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(dmsf_file.name))
|
||||
icon_class = icon_class_for_mime_type(dmsf_file.name)
|
||||
html << link_to(sprite_icon(icon_name, h(dmsf_file.title)),
|
||||
file_view_url,
|
||||
target: '_blank',
|
||||
rel: 'noopener',
|
||||
class: "icon #{icon_class}",
|
||||
title: h(dmsf_file.last_revision.try(:tooltip)),
|
||||
'data-downloadurl' => data)
|
||||
html << "<span class=\"size dmsf-size\">(#{number_to_human_size(dmsf_file.last_revision.size)})</span>"
|
||||
if dmsf_file.description.present?
|
||||
desc = clean_wiki_text(textilizable(dmsf_file.description))
|
||||
html << " - #{h(desc)}"
|
||||
end
|
||||
html << '</td>'
|
||||
# Author, updated at
|
||||
html << '<td>'
|
||||
author = "#{h(dmsf_file.last_revision.user)}, #{format_time(dmsf_file.last_revision.updated_at)}"
|
||||
html << "<span class=\"author\">#{author}</span>"
|
||||
html << '</td>'
|
||||
# Command icons
|
||||
html << '<td class="fast-icons easy-query-additional-ending-buttons hide-when-print">'
|
||||
# Details
|
||||
html << if User.current.allowed_to? :file_manipulation, dmsf_file.project
|
||||
link_to sprite_icon('edit', ''), dmsf_file_path(id: dmsf_file),
|
||||
title: l(:link_details, title: h(dmsf_file.last_revision.title)),
|
||||
class: 'icon icon-edit'
|
||||
else
|
||||
'<span class="icon"></span>'
|
||||
end
|
||||
# Email
|
||||
html << link_to(sprite_icon('email', ''),
|
||||
entries_operations_dmsf_path(id: dmsf_file.project, email_entries: 'email',
|
||||
files: [dmsf_file.id]),
|
||||
method: :post, title: l(:heading_send_documents_by_email), class: 'icon icon-email-disabled')
|
||||
# Lock
|
||||
html << if !dmsf_file.locked?
|
||||
link_to sprite_icon('lock', ''), lock_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_lock_file), class: 'icon icon-lock'
|
||||
elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? ||
|
||||
User.current.allowed_to?(:force_file_unlock, dmsf_file.project))
|
||||
link_to sprite_icon('unlock', ''), unlock_dmsf_files_path(id: dmsf_file),
|
||||
title: dmsf_file.locked_title, class: 'icon icon-unlock'
|
||||
else
|
||||
content_tag 'span',
|
||||
sprite_icon('unlock', ''),
|
||||
title: dmsf_file.locked_title,
|
||||
class: 'icon icon-unlock'
|
||||
end
|
||||
if dmsf_file.locked?
|
||||
html << ('<span class="icon"></span>' * 2)
|
||||
else
|
||||
# Notifications
|
||||
html << if dmsf_file.notification
|
||||
link_to sprite_icon('email', ''), notify_deactivate_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_notifications_active_deactivate), class: 'icon icon-email'
|
||||
else
|
||||
link_to sprite_icon('email-disabled', ''),
|
||||
notify_activate_dmsf_files_path(id: dmsf_file),
|
||||
title: l(:title_notifications_not_active_activate), class: 'icon icon-email-add'
|
||||
end
|
||||
# Delete
|
||||
if container.attributes_editable? && ((link && User.current.allowed_to?(:file_manipulation,
|
||||
dmsf_file.project)) || (!link &&
|
||||
User.current.allowed_to?(:file_delete, dmsf_file.project)))
|
||||
back_url = case container.class.name
|
||||
when 'Issue'
|
||||
issue_path container
|
||||
when 'EasyCrmCase'
|
||||
easy_crm_case_path container
|
||||
end
|
||||
url = if link
|
||||
dmsf_link_path link, commit: 'yes', back_url: back_url
|
||||
else
|
||||
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: back_url
|
||||
end
|
||||
html << delete_link(url, icon_only: true)
|
||||
end
|
||||
end
|
||||
# Approval workflow
|
||||
if dmsf_file.last_revision.dmsf_workflow_id
|
||||
wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id)
|
||||
end
|
||||
html << controller.send(:render_to_string,
|
||||
{ partial: 'dmsf_workflows/approval_workflow_button',
|
||||
locals: {
|
||||
file: dmsf_file,
|
||||
file_approval_allowed: User.current.allowed_to?(:file_approval,
|
||||
dmsf_file.project),
|
||||
workflows_available: DmsfWorkflow.exists?(['project_id = ? OR project_id IS NULL',
|
||||
dmsf_file.project.id]),
|
||||
project: dmsf_file.project,
|
||||
wf: wf,
|
||||
dmsf_link_id: nil
|
||||
} })
|
||||
html << '</td>'
|
||||
html << '</tr>'
|
||||
html
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
end
|
||||
ha2 = ActiveSupport::Digest.hexdigest("#{request.env['REQUEST_METHOD']}:#{uri}")
|
||||
required_response = if qop
|
||||
ActiveSupport::Digest.hexdigest("#{ha1}:#{nonce}:#{nc}:#{cnonce}:#{qop}:#{ha2}")
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This file is part of Redmine DMSF plugin.
|
||||
#
|
||||
# Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
module RedmineDmsf
|
||||
module Patches
|
||||
# AccessControl patch
|
||||
# TODO: This is just a workaround to fix alias_method usage in Easy's plugins, which is in conflict with
|
||||
# prepend and causes an infinite loop.
|
||||
module AccessControlEasyPatch
|
||||
##################################################################################################################
|
||||
# Overridden methods
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
|
||||
base.class_eval do
|
||||
class << self
|
||||
alias_method_chain :available_project_modules, :easy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Class methods
|
||||
module ClassMethods
|
||||
def available_project_modules_with_easy
|
||||
# Removes the original Documents from project's modules (replaced with DMSF)
|
||||
modules = available_project_modules_without_easy
|
||||
modules.delete(:documents) if RedmineDmsf.remove_original_documents_module?
|
||||
modules
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Apply the patch
|
||||
if defined?(EasyPatchManager)
|
||||
EasyPatchManager.register_other_patch 'Redmine::AccessControl', 'RedmineDmsf::Patches::AccessControlEasyPatch'
|
||||
end
|
||||
@ -1,40 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This file is part of Redmine DMSF plugin.
|
||||
#
|
||||
# Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
module RedmineDmsf
|
||||
module Patches
|
||||
# Attachable
|
||||
module AttachablePatch
|
||||
##################################################################################################################
|
||||
# Overridden methods
|
||||
|
||||
def has_attachments?
|
||||
super || (defined?(dmsf_files) && dmsf_files.any?) || (defined?(dmsf_links) && dmsf_links.any?)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Apply the patch
|
||||
if defined?(EasyPatchManager)
|
||||
EasyPatchManager.register_patch_to_be_first 'Redmine::Acts::Attachable::InstanceMethods',
|
||||
'RedmineDmsf::Patches::AttachablePatch', prepend: true, first: true
|
||||
else
|
||||
Redmine::Acts::Attachable.prepend RedmineDmsf::Patches::AttachablePatch
|
||||
end
|
||||
@ -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)" }
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This file is part of Redmine DMSF plugin.
|
||||
#
|
||||
# Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
|
||||
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
|
||||
require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# Attachable tests
|
||||
class AttachablePatchTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :issues, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@issue1 = Issue.find 1
|
||||
@issue5 = Issue.find 5
|
||||
end
|
||||
|
||||
def test_has_attachmets
|
||||
if defined?(EasyExtensions)
|
||||
assert @issue1.has_attachments?
|
||||
assert_not @issue5.has_attachments?
|
||||
else
|
||||
assert @issue1.dmsf_files.present?
|
||||
assert @issue5.dmsf_files.blank?
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -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
|
||||
assert RedmineDmsf::Plugin.an_obsolete_plugin_present?
|
||||
FileUtils.rm_rf(path) unless defined?(EasyExtensions)
|
||||
FileUtils.rm_rf path
|
||||
end
|
||||
|
||||
def test_lib_available?
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user