From 9348dea9b6d45f84430e92ca0dd732b77b2972e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 18 Feb 2015 12:39:14 +0100 Subject: [PATCH] [Feature Request] - overriding preconfigured Revision Tags/Steps #351 --- app/controllers/dmsf_files_controller.rb | 18 ++++++++++-- app/controllers/dmsf_upload_controller.rb | 8 +++++- .../dmsf_files/_file_new_revision.html.erb | 28 +++++++++++++------ app/views/dmsf_upload/_upload_file.html.erb | 13 +++++++-- config/locales/cs.yml | 3 ++ config/locales/de.yml | 3 ++ config/locales/en.yml | 3 ++ config/locales/es.yml | 3 ++ config/locales/ja.yml | 3 ++ config/locales/pl.yml | 3 ++ config/locales/ru.yml | 3 ++ config/locales/sl.yml | 3 ++ config/locales/zh-TW.yml | 10 ++++--- config/locales/zh.yml | 3 ++ 14 files changed, 84 insertions(+), 20 deletions(-) diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index f8dbba96..6541cf92 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -106,14 +108,24 @@ class DmsfFilesController < ApplicationController revision.major_version = last_revision.major_version revision.minor_version = last_revision.minor_version version = params[:version].to_i - file_upload = params[:file_upload] + file_upload = params[:file_upload] unless file_upload revision.disk_filename = last_revision.disk_filename - revision.increase_version(version, false) + if version == 3 + revision.major_version = params[:custom_version_major].to_i + revision.minor_version = params[:custom_version_minor].to_i + else + revision.increase_version(version, false) + end revision.mime_type = last_revision.mime_type revision.size = last_revision.size else - revision.increase_version(version, true) + if version == 3 + revision.major_version = params[:custom_version_major].to_i + revision.minor_version = params[:custom_version_minor].to_i + else + revision.increase_version(version, true) + end revision.size = file_upload.size revision.disk_filename = revision.new_storage_filename revision.mime_type = Redmine::MimeType.of(file_upload.original_filename) diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index cd3d845b..190e1986 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -128,7 +128,13 @@ class DmsfUploadController < ApplicationController new_revision.title = commited_file[:title] new_revision.description = commited_file[:description] new_revision.comment = commited_file[:comment] - new_revision.increase_version(commited_file[:version].to_i, true) + version = commited_file[:version].to_i + if version == 3 + new_revision.major_version = commited_file[:custom_version_major].to_i + new_revision.minor_version = commited_file[:custom_version_minor].to_i + else + new_revision.increase_version(version, true) + end new_revision.mime_type = Redmine::MimeType.of(new_revision.name) new_revision.size = File.size(commited_disk_filepath) diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb index c29fd0ba..24442574 100644 --- a/app/views/dmsf_files/_file_new_revision.html.erb +++ b/app/views/dmsf_files/_file_new_revision.html.erb @@ -1,9 +1,11 @@ <%#= +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-14 Karel Pičman +# Copyright (C) 2011-15 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -53,15 +55,23 @@ <%= label_tag('fileMinorVersionRadio', "#{l(:label_version)}:") %>

- <%= radio_button_tag('version', 0, @revision.version == @file.last_revision.version, :id => 'fileSameVersionRadio') %> - <%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version %> <%= l(:option_version_same) %>
+ <%= radio_button_tag('version', 0, + @revision.version == @file.last_revision.version) %> + <%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version %> + <%= l(:option_version_same) %>
<%= radio_button_tag('version', 1, - @revision.major_version == @file.last_revision.major_version && @revision.minor_version != @file.last_revision.minor_version, - :id => 'fileMinorVersionRadio') %> - <%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version + 1 %> <%= l(:option_version_minor) %>
- <%= radio_button_tag('version', 2, @revision.major_version != @file.last_revision.major_version) %> - <%= @file.last_revision.major_version + 1 %>.0 <%= l(:option_version_major) %>
-
+ @revision.major_version == @file.last_revision.major_version && + @revision.minor_version != @file.last_revision.minor_version) %> + <%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version + 1 %> + <%= l(:option_version_minor) %>
+ <%= radio_button_tag('version', 2, + @revision.major_version != @file.last_revision.major_version) %> + <%= @file.last_revision.major_version + 1 %>.0 + <%= l(:option_version_major) %>
+ <%= radio_button_tag('version', 3) %> + <%= select_tag 'custom_version_major', options_for_select(0..99, @file.last_revision.major_version + 2) %>.<%= select_tag 'custom_version_minor', options_for_select(0..99, @file.last_revision.minor_version + 1) %> + <%= l(:option_version_custom) %> +

diff --git a/app/views/dmsf_upload/_upload_file.html.erb b/app/views/dmsf_upload/_upload_file.html.erb index a552bb44..c917fd79 100644 --- a/app/views/dmsf_upload/_upload_file.html.erb +++ b/app/views/dmsf_upload/_upload_file.html.erb @@ -1,9 +1,11 @@ <%#= +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-14 Karel Pičman +# Copyright (C) 2011-15 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -48,9 +50,14 @@

<%= radio_button_tag("commited_files[#{i}][version]", 1, true) %> - <%= upload.major_version %>.<%= upload.minor_version + 1 %> <%= l(:option_version_minor) %>
+ <%= upload.major_version %>.<%= upload.minor_version + 1 %> + <%= l(:option_version_minor) %>
<%= radio_button_tag("commited_files[#{i}][version]", 2) %> - <%= upload.major_version + 1 %>.0 <%= l(:option_version_major) %>
+ <%= upload.major_version + 1 %>.0 + <%= l(:option_version_major) %>
+ <%= radio_button_tag("commited_files[#{i}][version]", 3) %> + <%= select_tag "commited_files[#{i}][custom_version_major]", options_for_select(0..99, upload.major_version + 2) %>.<%= select_tag "commited_files[#{i}][custom_version_minor]", options_for_select(0..99, upload.minor_version + 1) %> + <%= l(:option_version_custom) %>
diff --git a/config/locales/cs.yml b/config/locales/cs.yml index adcc114c..c879a1fe 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ cs: option_version_same: Stejná option_version_minor: Podružná option_version_major: Hlavní + option_version_custom: Vlastní label_new_content: Nový obsah label_maximum_files_upload: Maximální počet najednou nahraných souborů note_maximum_number_of_files_uploaded: Maximální počet najednou nahraných souborů. 0 znamená bez omezení. diff --git a/config/locales/de.yml b/config/locales/de.yml index a961fd57..30b728d6 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Terrence Miller @@ -119,6 +121,7 @@ de: option_version_major: Hauptversion label_new_content: Neuer Inhalt label_maximum_files_upload: Maximal hochzuladende Dateien + option_version_custom: Benutzerdefinierte note_maximum_number_of_files_uploaded: Beschränkt die Anzahl der maximal auf einmal hochladbaren Dateien. 0 bedeutet unbeschränkt. label_maximum_files_download: Maximal herunterzuladende Dateien note_maximum_number_of_files_downloaded: Beschränkt die Anzahl der maximal auf einmal herunterladbaren Dateien (per ZIP oder Mail). 0 bedeutet unbeschränkt. diff --git a/config/locales/en.yml b/config/locales/en.yml index 0b88c7db..19a3434a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ en: option_version_same: Same option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: New content label_maximum_files_upload: Maximum files upload note_maximum_number_of_files_uploaded: Limits maximum number of files uploaded at once. 0 means unlimited. diff --git a/config/locales/es.yml b/config/locales/es.yml index 8838c6d4..3db67baf 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ es: option_version_same: Same option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: New content label_maximum_files_upload: Maximum files upload note_maximum_number_of_files_uploaded: Limits maximum number of files uploaded at once. 0 means unlimited. diff --git a/config/locales/ja.yml b/config/locales/ja.yml index fe1c2939..5734d738 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ ja: option_version_same: 変更なし option_version_minor: マイナー option_version_major: メジャー + option_version_custom: Custom label_new_content: 新規コンテンツ label_maximum_files_upload: 最大ファイルアップロード数 note_maximum_number_of_files_uploaded: 一度にアップロードできるファイル数の上限。0は無制限。 diff --git a/config/locales/pl.yml b/config/locales/pl.yml index af15103e..561c1e74 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -120,6 +122,7 @@ pl: option_version_same: Same option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: Nowa zawartość label_maximum_files_upload: Maximum files upload note_maximum_number_of_files_uploaded: Maksymalna liczba jednocześnie przesyłanych plików. 0 oznacza brak ograniczeń. diff --git a/config/locales/ru.yml b/config/locales/ru.yml index b9b73870..401d134b 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ ru: option_version_same: Та же версия option_version_minor: Незначительные изменения option_version_major: Значительные изменения + option_version_custom: Custom label_new_content: Новое содержание label_maximum_files_upload: Максимальное количество файлов для загрузки note_maximum_number_of_files_uploaded: Ограничивает максимальное количество файлов, которое может быть загружено за один раз. 0 означает отсутствие ограничений. diff --git a/config/locales/sl.yml b/config/locales/sl.yml index e0a975da..b660b240 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 @@ -119,6 +121,7 @@ sl: option_version_same: Enako option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: Nova vsebina label_maximum_files_upload: Maximum naloženih datotek note_maximum_number_of_files_uploaded: Omejitev največjega števila datotek za nalaganje naenkrat. 0 pomeni neomejeno. diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 88797a00..0b184f01 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1,8 +1,10 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2011-15 Karel Pičman -# +# Copyright (C) 2013 Aecho Liu # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Translated by Aecho Liu, (aecho1028@gmail.com) -"zh-TW": + +zh-TW: dmsf: 文件總管 label_dmsf_file_plural: 文件檔案 label_dmsf_file_revision_plural: Dmsf document revisions @@ -122,6 +123,7 @@ option_version_same: Same option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: 新的檔案內容 label_maximum_files_upload: 最大上傳檔案數量 note_maximum_number_of_files_uploaded: 同時間所能上傳的,最大檔案數量限制。 0 表示沒有限制。 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 87b05216..e128eefb 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš @@ -119,6 +121,7 @@ zh: option_version_same: Same option_version_minor: Minor option_version_major: Major + option_version_custom: Custom label_new_content: 新内容 label_maximum_files_upload: 最大上传文件数 note_maximum_number_of_files_uploaded: 一次上传的最大文件数量. 0表示无限制.