diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77683d6c..f7dbff0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,8 @@ Changelog for Redmine DMSF
Global title format for downloading
New columns in the main DMSF view; columns are configurable from the plugin settings
+* New: #675 - Keep documents locked after the approval workflow is finished as an option
+* Bug: #671 - Webdav: MOVE returns incorrect response
* Bug: #663 - Locked documnts on My page
* Bug: #662 - Broken paging on the Add approver form
* New: #655 - ERROR: Couldn't find Project with identifier=desktop.ini
diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb
index aaadf8f4..fb301fca 100644
--- a/app/controllers/dmsf_workflows_controller.rb
+++ b/app/controllers/dmsf_workflows_controller.rb
@@ -55,7 +55,7 @@ class DmsfWorkflowsController < ApplicationController
if @dmsf_workflow.try_finish revision, action, (params[:step_action].to_i / 10)
if revision.dmsf_file
begin
- revision.dmsf_file.unlock! true
+ revision.dmsf_file.unlock!(true) unless Setting.plugin_redmine_dmsf['dmsf_keep_documents_locked'].present?
rescue DmsfLockError => e
flash[:info] = e.message
end
@@ -205,6 +205,10 @@ class DmsfWorkflowsController < ApplicationController
def log
end
+ def edit
+ redirect_to dmsf_workflow_path(@dmsf_workflow)
+ end
+
def new
@dmsf_workflow = DmsfWorkflow.new
diff --git a/app/helpers/dmsf_workflows_helper.rb b/app/helpers/dmsf_workflows_helper.rb
index 9150970a..33e2259d 100644
--- a/app/helpers/dmsf_workflows_helper.rb
+++ b/app/helpers/dmsf_workflows_helper.rb
@@ -61,7 +61,7 @@ module DmsfWorkflowsHelper
if wf.project_id
options << [wf.name, wf.id]
else
- options << ["#{wf.name} (global)", wf.id]
+ options << ["#{wf.name} #{l(:note_global)}", wf.id]
end
end
options_for_select(options, :selected => dmsf_workflow_id)
@@ -83,7 +83,7 @@ module DmsfWorkflowsHelper
end
else
# Global approval workflows
- options << [wf.name, wf.id]
+ options << ["#{wf.name} #{l(:note_global)}", wf.id]
end
end
options_for_select(options, :selected => dmsf_workflow_id)
diff --git a/app/views/settings/_dmsf_settings.html.erb b/app/views/settings/_dmsf_settings.html.erb
index c1cffd99..ff5b56d2 100644
--- a/app/views/settings/_dmsf_settings.html.erb
+++ b/app/views/settings/_dmsf_settings.html.erb
@@ -135,6 +135,20 @@
<%= render(:partial => 'settings/dmsf_columns', :locals => { :settings => @settings }) %>
+
+
+ <%= l(:field_label_dmsf_workflow) %>
+
+
+
+ <%= content_tag(:label, l(:label_dmsf_keep_documents_locked)) %>
+ <%= check_box_tag('settings[dmsf_keep_documents_locked]', false, @settings['dmsf_keep_documents_locked']) %>
+
+ <%= l(:note_dmsf_keep_documents_locked) %>
+ <%= l(:label_default)%>: <%= l(:general_text_No)%>
+
+
+
<%= l(:label_webdav) %>
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 78a8034a..09aa9ff3 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -351,3 +351,7 @@ cs:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Ponechat dokumenty zamčené
+ note_dmsf_keep_documents_locked: Dokumenty zůstanou i po schválení zamčené.
+ note_global: (globální)
\ No newline at end of file
diff --git a/config/locales/de.yml b/config/locales/de.yml
index ba711b54..a7f1bf82 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -348,3 +348,7 @@ de:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b938f41c..a8360177 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -351,3 +351,7 @@ en:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 3a7b581e..8b6af2c6 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -351,3 +351,7 @@ es:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index edce031c..747bcaff 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -351,3 +351,7 @@ fr:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 2fab602c..6d38e575 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -351,3 +351,7 @@ it: # Italian strings thx 2 Matteo Arceci!
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index fe3aa3d1..f2eed002 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -351,3 +351,7 @@ ja:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 21b3339f..21fa300d 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -351,3 +351,7 @@ pl:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index f4d6fa26..8d3363ec 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -351,3 +351,7 @@ pt-BR:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index cbe16306..e4ee5f3c 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -351,3 +351,7 @@ ru:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index c00d3520..e43b28bd 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -351,3 +351,7 @@ sl:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 1f34ceba..782ae8b6 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -351,3 +351,7 @@ zh-TW:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index b66034ac..22456cbf 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -351,3 +351,7 @@ zh:
label_webdav_disable_versioning: No versioning files patterns
note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern matches temporary files created by MsOffice.
+
+ label_dmsf_keep_documents_locked: Keep documents locked
+ note_dmsf_keep_documents_locked: Documents will be kept locked when approved
+ note_global: (global)
\ No newline at end of file
diff --git a/dmsf_user_guide.odt b/dmsf_user_guide.odt
index 7e965773..84600ee8 100644
Binary files a/dmsf_user_guide.odt and b/dmsf_user_guide.odt differ
diff --git a/init.rb b/init.rb
index 37e8afdf..cabd4a7d 100644
--- a/init.rb
+++ b/init.rb
@@ -50,7 +50,8 @@ Redmine::Plugin.register :redmine_dmsf do
'dmsf_columns' => %w(title size modified version workflow author),
'dmsf_memcached_servers' => '',
'dmsf_webdav_ignore' => '^(\._|\.DS_Store$|Thumbs.db$)',
- 'dmsf_webdav_disable_versioning' => '^\~\$|\.tmp$'
+ 'dmsf_webdav_disable_versioning' => '^\~\$|\.tmp$',
+ 'dmsf_keep_documents_locked' => false
}
menu :project_menu, :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, :param => :id
@@ -95,7 +96,7 @@ Redmine::Plugin.register :redmine_dmsf do
{:dmsf_workflows => [:action, :new_action, :autocomplete_for_user, :start, :assign, :assignment]}
permission :manage_workflows,
{:dmsf_workflows => [:index, :new, :create, :destroy, :show, :new_step, :add_step, :remove_step, :reorder_steps,
- :update, :update_step, :delete_step]}
+ :update, :update_step, :delete_step, :edit]}
end
# Administration menu extension
diff --git a/test/ci/redmine_install.sh b/test/ci/redmine_install.sh
index 203e56f1..0443513a 100644
--- a/test/ci/redmine_install.sh
+++ b/test/ci/redmine_install.sh
@@ -1,4 +1,4 @@
-#/bin/bash
+#!/bin/bash
#
# This script is almost entirely built on the build script from redmine_backlogs
# Please see: https://github.com/backlogs/redmine_backlogs
diff --git a/test/functional/dmsf_workflow_controller_test.rb b/test/functional/dmsf_workflow_controller_test.rb
index 13ba2764..bf4b5af2 100644
--- a/test/functional/dmsf_workflow_controller_test.rb
+++ b/test/functional/dmsf_workflow_controller_test.rb
@@ -279,19 +279,16 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase
end
def test_action_approve
- post(
- :new_action,
- :commit => l(:button_submit),
- :id => @wf1.id,
- :dmsf_workflow_step_assignment_id => @wfsa2.id,
- :dmsf_file_revision_id => @revision1.id,
- :step_action => DmsfWorkflowStepAction::ACTION_APPROVE,
- :user_id => nil,
- :note => '')
- assert_redirected_to dmsf_folder_path(:id => @project1.id)
- assert DmsfWorkflowStepAction.where(
- :dmsf_workflow_step_assignment_id => @wfsa2.id,
- :action => DmsfWorkflowStepAction::ACTION_APPROVE).first
+ approve
+ assert !@revision1.dmsf_file.locked_for_user?
+ end
+
+ def test_action_approve
+ Setting.plugin_redmine_dmsf['dmsf_keep_documents_locked'] = '1'
+ approve
+ if Setting.plugin_redmine_dmsf['dmsf_keep_documents_locked'] == '1'
+ assert @revision1.dmsf_file.locked_for_user?
+ end
end
def test_action_reject
@@ -397,4 +394,21 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase
assert_response :redirect
end
+ private
+
+ def approve
+ post(
+ :new_action,
+ :commit => l(:button_submit),
+ :id => @wf1.id,
+ :dmsf_workflow_step_assignment_id => @wfsa2.id,
+ :dmsf_file_revision_id => @revision1.id,
+ :step_action => DmsfWorkflowStepAction::ACTION_APPROVE,
+ :user_id => nil,
+ :note => '')
+ assert_redirected_to dmsf_folder_path(:id => @project1.id)
+ assert DmsfWorkflowStepAction.where(
+ :dmsf_workflow_step_assignment_id => @wfsa2.id,
+ :action => DmsfWorkflowStepAction::ACTION_APPROVE).first
+ end
end