Append File Revision on filename when downloading file #44
This commit is contained in:
parent
a4a0a8e598
commit
935d17ab7e
@ -30,7 +30,7 @@ class DmsfController < ApplicationController
|
||||
before_filter :find_project
|
||||
before_filter :authorize
|
||||
before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
|
||||
before_filter :find_parent, :only => [:new, :create]
|
||||
before_filter :find_parent, :only => [:new, :create]
|
||||
|
||||
accept_api_auth :show, :create
|
||||
|
||||
@ -489,11 +489,12 @@ class DmsfController < ApplicationController
|
||||
end
|
||||
|
||||
def zip_entries(zip, selected_folders, selected_files)
|
||||
member = Member.where(:user_id => User.current.id, :project_id => @project.id).first
|
||||
if selected_folders && selected_folders.is_a?(Array)
|
||||
selected_folders.each do |selected_folder_id|
|
||||
folder = DmsfFolder.visible.find_by_id selected_folder_id
|
||||
if folder
|
||||
zip.add_folder(folder, (folder.folder.dmsf_path_str if folder.folder))
|
||||
zip.add_folder(folder, member, (folder.folder.dmsf_path_str if folder.folder))
|
||||
else
|
||||
raise FileNotFound
|
||||
end
|
||||
@ -506,7 +507,7 @@ class DmsfController < ApplicationController
|
||||
raise DmsfAccessError
|
||||
end
|
||||
if file && file.last_revision && File.exists?(file.last_revision.disk_file)
|
||||
zip.add_file(file, (file.folder.dmsf_path_str if file.folder)) if file
|
||||
zip.add_file(file, member, (file.folder.dmsf_path_str if file.folder)) if file
|
||||
else
|
||||
raise FileNotFound
|
||||
end
|
||||
|
||||
@ -26,7 +26,7 @@ class DmsfFilesController < ApplicationController
|
||||
|
||||
before_filter :find_file, :except => [:delete_revision]
|
||||
before_filter :find_revision, :only => [:delete_revision]
|
||||
before_filter :authorize
|
||||
before_filter :authorize
|
||||
|
||||
accept_api_auth :show
|
||||
|
||||
@ -52,8 +52,9 @@ class DmsfFilesController < ApplicationController
|
||||
access.revision = @revision
|
||||
access.action = DmsfFileRevisionAccess::DownloadAction
|
||||
access.save!
|
||||
send_file(@revision.disk_file,
|
||||
:filename => filename_for_content_disposition(@revision.name),
|
||||
member = Member.where(:user_id => User.current.id, :project_id => @file.project.id).first
|
||||
send_file(@revision.disk_file,
|
||||
:filename => filename_for_content_disposition(@revision.formatted_name(member ? member.title_format : nil)),
|
||||
:type => @revision.detect_content_type,
|
||||
:disposition => 'inline')
|
||||
rescue ActionController::MissingFile
|
||||
@ -82,8 +83,9 @@ class DmsfFilesController < ApplicationController
|
||||
access.revision = @revision
|
||||
access.action = DmsfFileRevisionAccess::DownloadAction
|
||||
access.save!
|
||||
send_file(@revision.disk_file,
|
||||
:filename => filename_for_content_disposition(@revision.name),
|
||||
member = Member.where(:user_id => User.current.id, :project_id => @file.project.id).first
|
||||
send_file(@revision.disk_file,
|
||||
:filename => filename_for_content_disposition(@revision.formatted_name(member ? member.title_format : nil)),
|
||||
:type => @revision.detect_content_type,
|
||||
:disposition => 'attachment')
|
||||
rescue ActionController::MissingFile
|
||||
@ -319,7 +321,7 @@ class DmsfFilesController < ApplicationController
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
|
||||
def check_project(entry)
|
||||
if entry && entry.project != @project
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
|
||||
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -29,12 +31,22 @@ class DmsfStateController < ApplicationController
|
||||
member = @project.members.where(:user_id => User.current.id).first
|
||||
if member
|
||||
member.dmsf_mail_notification = params[:email_notify]
|
||||
member.save!
|
||||
flash[:notice] = l(:notice_your_preferences_were_saved)
|
||||
member.title_format = params[:title_format]
|
||||
if format_valid?(member.title_format) && member.save
|
||||
flash[:notice] = l(:notice_your_preferences_were_saved)
|
||||
else
|
||||
flash[:error] = l(:notice_your_preferences_were_not_saved)
|
||||
end
|
||||
else
|
||||
flash[:warning] = l(:user_is_not_project_member)
|
||||
end
|
||||
redirect_to settings_project_path(@project, :tab => 'dmsf')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_valid?(format)
|
||||
format.blank? || ((format =~ /%(t|d|v|i|r)/) && format.length < 256)
|
||||
end
|
||||
|
||||
end
|
||||
@ -428,5 +428,13 @@ class DmsfFile < ActiveRecord::Base
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def formatted_name(format)
|
||||
if self.last_revision
|
||||
self.last_revision.formatted_name(format)
|
||||
else
|
||||
self.name
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -247,5 +247,21 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
parts = self.version.split '.'
|
||||
parts.size == 2 ? parts[0].to_i * 1000 + parts[1].to_i : 0
|
||||
end
|
||||
|
||||
def formatted_name(format)
|
||||
return self.name if format.blank?
|
||||
if self.name =~ /(.*)(\..*)$/
|
||||
filename = $1
|
||||
ext = $2
|
||||
else
|
||||
filename = self.name
|
||||
end
|
||||
format.sub!('%t', filename)
|
||||
format.sub!('%d', self.updated_at.strftime('%Y%m%d%H%M%S'))
|
||||
format.sub!('%v', self.version)
|
||||
format.sub!('%i', self.file.id.to_s)
|
||||
format.sub!('%r', self.id.to_s)
|
||||
format + ext
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -18,19 +18,28 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<p><strong><%=l(:link_user_preferences)%></strong></p>
|
||||
<div class="box">
|
||||
<%= form_tag({:controller => 'dmsf_state', :action => 'user_pref_save', :id => @project}, :method => :post) do %>
|
||||
<div>
|
||||
<% member = @project.members.where(:user_id => User.current.id).first %>
|
||||
<% mail_notification = member ? member.dmsf_mail_notification : nil %>
|
||||
<%= l(:label_notifications) %>:
|
||||
<% member = @project.members.where(:user_id => User.current.id).first %>
|
||||
<% if member %>
|
||||
<% mail_notification = member.dmsf_mail_notification %>
|
||||
<% title_format = member.title_format %>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag(dmsf_user_pref_save_path(@project)) do %>
|
||||
<fieldset class="box tabular">
|
||||
<legend><%= l(:link_user_preferences) %></legend>
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_notifications)}:") %>
|
||||
<%= select_tag(
|
||||
'email_notify',
|
||||
options_for_select([[l(:select_option_default), nil],
|
||||
[l(:select_option_activated), true], [l(:select_option_deactivated), false]],
|
||||
:selected => mail_notification)) %>
|
||||
<%= submit_tag(l(:submit_save), :title => l(:title_save_preferences)) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
'email_notify',
|
||||
options_for_select([[l(:select_option_default), nil],
|
||||
[l(:select_option_activated), true], [l(:select_option_deactivated), false]],
|
||||
:selected => mail_notification)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_title_format)}:") %>
|
||||
<%= text_field_tag 'title_format', title_format, :size => 10 %>
|
||||
<em class="info"><%= l(:text_title_format) %></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
<%= submit_tag(l(:submit_save), :title => l(:title_save_preferences)) %>
|
||||
<% end %>
|
||||
@ -155,7 +155,8 @@
|
||||
<%= text_field_tag 'settings[dmsf_stemming_lang]', @settings['dmsf_stemming_lang'], :disabled => xapian_disabled %><br/>
|
||||
(<%= l(:label_default)%>: english )<br/>
|
||||
<br/>
|
||||
<%= l(:note_possible_values)%>: danish dutch english finnish french german german2 hungarian italian kraaij_pohlmann lovins norwegian porter portuguese romanian russian spanish swedish turkish (<%= l(:note_pass_none_to_disable_stemming) %>)</p>
|
||||
<%= l(:note_possible_values)%>: danish dutch english finnish french german german2 hungarian italian kraaij_pohlmann lovins norwegian porter portuguese romanian russian spanish swedish turkish (<%= l(:note_pass_none_to_disable_stemming) %>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_stem_strategy) + ":")%>
|
||||
|
||||
@ -50,6 +50,7 @@ cs:
|
||||
notice_file_unlocked: Soubor byl odemčen
|
||||
notice_file_revision_created: vytvořena nová revize
|
||||
notice_your_preferences_were_saved: Vaše nastavení bylo uloženo
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Notifikace složky již byly aktivovány
|
||||
notice_folder_notifications_activated: Notifikace složky byly aktivovány
|
||||
warning_folder_notifications_already_deactivated: Notifikace složky již byly deaktivovány
|
||||
@ -107,6 +108,8 @@ cs:
|
||||
select_option_default: Výchozí
|
||||
select_option_deactivated: Deaktivováno
|
||||
select_option_activated: Aktivováno
|
||||
label_title_format: Formát názvu
|
||||
text_title_format: "Formát názvu souboru pro stažení (%t - název, %d - datum, %v- verze, %i - ID, %r - revize). Např.: %t_%v"
|
||||
title_save_preferences: Uložit nastavení
|
||||
heading_revisions: Revize
|
||||
title_download: Stáhnout
|
||||
|
||||
@ -40,7 +40,7 @@ de:
|
||||
notice_folder_deleted: Ordner gelöscht
|
||||
error_folder_is_not_empty: Ordner ist nicht leer
|
||||
error_folder_title_is_already_used: Titel wird schon benutzt. Denk dir was Neues aus.
|
||||
notice_folder_details_were_saved: Ordnerdetails wurden gespeichert
|
||||
notice_folder_details_were_saved: Ordnerdetails wurden gespeichert
|
||||
error_folder_is_locked: Ordner ist gesperrt
|
||||
error_file_is_locked: Datei ist gesperrt
|
||||
notice_file_deleted: Datei gelöscht
|
||||
@ -50,6 +50,7 @@ de:
|
||||
notice_file_unlocked: Dateisperre gelöst
|
||||
notice_file_revision_created: Dateiversion erstellt
|
||||
notice_your_preferences_were_saved: Deine Einstellungen wurden gespeichert
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Ordnerbenachrichtigungen sind schon aktiviert
|
||||
notice_folder_notifications_activated: Ordnerbenachrichtigungen aktiviert
|
||||
warning_folder_notifications_already_deactivated: Ordnerbenachrichtigungen sind schon deaktiviert
|
||||
@ -107,6 +108,8 @@ de:
|
||||
select_option_default: Voreinstellung
|
||||
select_option_deactivated: Aus
|
||||
select_option_activated: Ein
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Einstellungen speichern
|
||||
heading_revisions: Versionen
|
||||
title_download: Download
|
||||
|
||||
@ -40,7 +40,7 @@ en:
|
||||
notice_folder_deleted: Folder deleted
|
||||
error_folder_is_not_empty: Folder is not empty
|
||||
error_folder_title_is_already_used: Title is already used
|
||||
notice_folder_details_were_saved: Folder details were saved
|
||||
notice_folder_details_were_saved: Folder details were saved
|
||||
error_folder_is_locked: Folder is locked
|
||||
error_file_is_locked: File is locked
|
||||
notice_file_deleted: File deleted
|
||||
@ -50,6 +50,7 @@ en:
|
||||
notice_file_unlocked: File unlocked
|
||||
notice_file_revision_created: File revision created
|
||||
notice_your_preferences_were_saved: Your preferences were saved
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Folder notifications already activated
|
||||
notice_folder_notifications_activated: Folder notifications activated
|
||||
warning_folder_notifications_already_deactivated: Folder notifications already deactivated
|
||||
@ -107,6 +108,8 @@ en:
|
||||
select_option_default: Default
|
||||
select_option_deactivated: Deactivated
|
||||
select_option_activated: Activated
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Save preferences
|
||||
heading_revisions: Revisions
|
||||
title_download: Download
|
||||
|
||||
@ -40,7 +40,7 @@ es:
|
||||
notice_folder_deleted: Carpeta borrada
|
||||
error_folder_is_not_empty: La carpeta no está vacía
|
||||
error_folder_title_is_already_used: El título ingresado ya está siendo usado por otro documento
|
||||
notice_folder_details_were_saved: Los detalles de la carpeta fueron grabados correctamente
|
||||
notice_folder_details_were_saved: Los detalles de la carpeta fueron grabados correctamente
|
||||
error_folder_is_locked: Carpeta bloqueado
|
||||
error_file_is_locked: Archivo bloqueado
|
||||
notice_file_deleted: Archivo borrado
|
||||
@ -50,6 +50,7 @@ es:
|
||||
notice_file_unlocked: Archivo desbloqueado
|
||||
notice_file_revision_created: Revision de archivos creada correctamente
|
||||
notice_your_preferences_were_saved: Sus preferencias han sido guardadas correctamente
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Las notificaciones de la carpeta seleccionada ya están activadas previamente
|
||||
notice_folder_notifications_activated: Notificaciones de carpeta activadas
|
||||
warning_folder_notifications_already_deactivated: Las notificaciones de la carpeta seleccionada ya están desactivadas previamente
|
||||
@ -107,6 +108,8 @@ es:
|
||||
select_option_default: Default
|
||||
select_option_deactivated: Desactivado
|
||||
select_option_activated: Activado
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Guardar Preferencias
|
||||
heading_revisions: Revisiones
|
||||
title_download: Descargar
|
||||
|
||||
@ -40,7 +40,7 @@ fr:
|
||||
notice_folder_deleted: Dossier supprimé
|
||||
error_folder_is_not_empty: "Le dossier n'est pas vide"
|
||||
error_folder_title_is_already_used: Le titre du fichier est déjà utilisé
|
||||
notice_folder_details_were_saved: Les détails du dossier ont été enregistrés
|
||||
notice_folder_details_were_saved: Les détails du dossier ont été enregistrés
|
||||
error_folder_is_locked: Le dossier est verrouillé
|
||||
error_file_is_locked: Le fichier est verrouillé
|
||||
notice_file_deleted: Le fichier a été supprimé
|
||||
@ -50,6 +50,7 @@ fr:
|
||||
notice_file_unlocked: Fichier déverrouillé
|
||||
notice_file_revision_created: La révision du fichier a été ajoutée
|
||||
notice_your_preferences_were_saved: Vos paramètres ont été enregistrés
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Les notifications du dossier sont déjà activées
|
||||
notice_folder_notifications_activated: Les notifications du dossier ont été activées
|
||||
warning_folder_notifications_already_deactivated: Les notifications du dossier sont déjà désactivées
|
||||
@ -107,6 +108,8 @@ fr:
|
||||
select_option_default: Défaut
|
||||
select_option_deactivated: Désactivé
|
||||
select_option_activated: Activé
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Enregistrer les préférences
|
||||
heading_revisions: Révisions
|
||||
title_download: Télécharger
|
||||
|
||||
@ -40,7 +40,7 @@ ja:
|
||||
notice_folder_deleted: フォルダを削除しました
|
||||
error_folder_is_not_empty: フォルダが空ではありません
|
||||
error_folder_title_is_already_used: タイトルは既に使われています
|
||||
notice_folder_details_were_saved: フォルダの詳細を保存しました
|
||||
notice_folder_details_were_saved: フォルダの詳細を保存しました
|
||||
error_folder_is_locked: Folder is locked
|
||||
error_file_is_locked: ファイルはロックされています
|
||||
notice_file_deleted: ファイルを削除しました
|
||||
@ -50,6 +50,7 @@ ja:
|
||||
notice_file_unlocked: ファイルをロック解除しました
|
||||
notice_file_revision_created: ファイルのリビジョンを作成しました
|
||||
notice_your_preferences_were_saved: あなたの設定を保存しました
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: フォルダ通知は既に有効です
|
||||
notice_folder_notifications_activated: フォルダ通知を有効にしました
|
||||
warning_folder_notifications_already_deactivated: フォルダ通知は既に無効です
|
||||
@ -107,6 +108,8 @@ ja:
|
||||
select_option_default: 既定値
|
||||
select_option_deactivated: 無効
|
||||
select_option_activated: 有効
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: 設定を保存します
|
||||
heading_revisions: リビジョン
|
||||
title_download: ダウンロードします
|
||||
|
||||
@ -40,7 +40,7 @@ pl:
|
||||
error_folder_title_must_be_entered: Musisz podać tytuł
|
||||
notice_folder_deleted: Folder został usunięty
|
||||
error_folder_is_not_empty: Folder zawiera pliki
|
||||
error_folder_title_is_already_used: Podany tytuł jest już w użyciu
|
||||
error_folder_title_is_already_used: Podany tytuł jest już w użyciu
|
||||
notice_folder_details_were_saved: Szczegóły folderu zostały zapisane
|
||||
error_folder_is_locked: Folder jest zablokowany
|
||||
error_file_is_locked: Plik jest zablokowany
|
||||
@ -51,6 +51,7 @@ pl:
|
||||
notice_file_unlocked: Plik odblokowany
|
||||
notice_file_revision_created: Utworzono wersję pliku
|
||||
notice_your_preferences_were_saved: Twoje preferencje zostały zapisane
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Powiadomienia dla folderu zostały już aktywowane
|
||||
notice_folder_notifications_activated: Aktywowano powiadomienia dla folderu
|
||||
warning_folder_notifications_already_deactivated: Powiadomienia dla folderu zostały już wyłączone
|
||||
@ -107,6 +108,8 @@ pl:
|
||||
label_notifications: Powiadomienia
|
||||
select_option_default: Domyślny
|
||||
select_option_deactivated: Wyłączono
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
select_option_activated: Aktywowano
|
||||
title_save_preferences: Zapisz ustawienia
|
||||
heading_revisions: Wersje
|
||||
|
||||
@ -40,7 +40,7 @@ pt-BR:
|
||||
notice_folder_deleted: Pasta deletada
|
||||
error_folder_is_not_empty: Pasta não está vazia
|
||||
error_folder_title_is_already_used: Título já utilizado
|
||||
notice_folder_details_were_saved: Pasta atualizada
|
||||
notice_folder_details_were_saved: Pasta atualizada
|
||||
error_folder_is_locked: Pasta está bloqueada
|
||||
error_file_is_locked: Arquivo está bloqueado
|
||||
notice_file_deleted: Arquivo excluído
|
||||
@ -50,6 +50,7 @@ pt-BR:
|
||||
notice_file_unlocked: Arquivo desbloqueado
|
||||
notice_file_revision_created: Revisão do arquivo criado
|
||||
notice_your_preferences_were_saved: Suas atualizações foram salvas
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Notificações de pasta atualizadas
|
||||
notice_folder_notifications_activated: Notificações da pasta ativas
|
||||
warning_folder_notifications_already_deactivateNd: Notificações da pasta desativadas
|
||||
@ -107,6 +108,8 @@ pt-BR:
|
||||
select_option_default: Padrão
|
||||
select_option_deactivated: Desativado
|
||||
select_option_activated: Ativado
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Salvar preferências
|
||||
heading_revisions: Revisões
|
||||
title_download: Download
|
||||
|
||||
@ -40,7 +40,7 @@ ru:
|
||||
notice_folder_deleted: Папка удалена
|
||||
error_folder_is_not_empty: Папка не пустая
|
||||
error_folder_title_is_already_used: Название папки уже используется
|
||||
notice_folder_details_were_saved: Описание папки было сохранено
|
||||
notice_folder_details_were_saved: Описание папки было сохранено
|
||||
error_folder_is_locked: Папка заблокированa
|
||||
error_file_is_locked: Файл заблокирован
|
||||
notice_file_deleted: Файл удален
|
||||
@ -50,6 +50,7 @@ ru:
|
||||
notice_file_unlocked: Файл разблокирован
|
||||
notice_file_revision_created: Редакция файла создана
|
||||
notice_your_preferences_were_saved: Ваши настройки были сохранены
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Уведомления папки уже включены
|
||||
notice_folder_notifications_activated: Уведомления папки включены
|
||||
warning_folder_notifications_already_deactivated: Уведомления папки уже отключены
|
||||
@ -107,6 +108,8 @@ ru:
|
||||
select_option_default: По умолчанию
|
||||
select_option_deactivated: Отключено
|
||||
select_option_activated: Включено
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Сохранить настройки
|
||||
heading_revisions: Редакции
|
||||
title_download: Скачать
|
||||
|
||||
@ -40,7 +40,7 @@ sl:
|
||||
notice_folder_deleted: Mapa izbrisana
|
||||
error_folder_is_not_empty: Mapa ni prazna
|
||||
error_folder_title_is_already_used: Naslov je že uporabljen
|
||||
notice_folder_details_were_saved: Podatki o mapi so shranjeni
|
||||
notice_folder_details_were_saved: Podatki o mapi so shranjeni
|
||||
error_folder_is_locked: Папка заблокированa
|
||||
error_file_is_locked: Mapa je zaklenjena
|
||||
notice_file_deleted: Datoteka izbrisana
|
||||
@ -50,6 +50,7 @@ sl:
|
||||
notice_file_unlocked: Datoteka odklenjena
|
||||
notice_file_revision_created: Verzija datoteke kreirana
|
||||
notice_your_preferences_were_saved: Vaše nastavitve so shranjene
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: Obveščanje o mapi je že aktivno
|
||||
notice_folder_notifications_activated: Obveščanje o mapi je aktivirano
|
||||
warning_folder_notifications_already_deactivated: Obveščanje o mapi je že neaktivno
|
||||
@ -107,6 +108,8 @@ sl:
|
||||
select_option_default: Privzeto
|
||||
select_option_deactivated: Deaktivirano
|
||||
select_option_activated: Aktivirano
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: Save preferences
|
||||
heading_revisions: Verzije
|
||||
title_download: Prenesi dol
|
||||
|
||||
@ -40,7 +40,7 @@ zh-TW:
|
||||
notice_folder_deleted: 資料夾己刪除
|
||||
error_folder_is_not_empty: 資料夾尚未清空
|
||||
error_folder_title_is_already_used: 標題己經被使用了
|
||||
notice_folder_details_were_saved: 資料夾描述己儲存
|
||||
notice_folder_details_were_saved: 資料夾描述己儲存
|
||||
error_folder_is_locked: 資料夾己經鎖定
|
||||
error_file_is_locked: 檔案己經被鎖定了
|
||||
notice_file_deleted: 檔案己經被刪除了
|
||||
@ -50,6 +50,7 @@ zh-TW:
|
||||
notice_file_unlocked: 檔案己經解除鎖定
|
||||
notice_file_revision_created: 檔案修訂版本己建立
|
||||
notice_your_preferences_were_saved: 您的偏好設定己經儲存
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: 資料夾通知己經啟用了
|
||||
notice_folder_notifications_activated: 資料夾通知啟用了
|
||||
warning_folder_notifications_already_deactivated: 資料夾通知己經關閉了
|
||||
@ -107,6 +108,8 @@ zh-TW:
|
||||
select_option_default: 預設
|
||||
select_option_deactivated: 關閉
|
||||
select_option_activated: 啟用
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
title_save_preferences: 儲存偏好設定
|
||||
heading_revisions: 修訂版本
|
||||
title_download: 下載
|
||||
|
||||
@ -50,6 +50,7 @@ zh:
|
||||
notice_file_unlocked: 文件解锁
|
||||
notice_file_revision_created: 文件修订版本已创建
|
||||
notice_your_preferences_were_saved: 您的偏好设定已保存
|
||||
notice_your_preferences_were_not_saved: Your preferences were not saved
|
||||
warning_folder_notifications_already_activated: 文件夹通知已激活
|
||||
notice_folder_notifications_activated: 文件夹通知激活
|
||||
warning_folder_notifications_already_deactivated: 文件夹通知已注销
|
||||
@ -108,6 +109,8 @@ zh:
|
||||
select_option_deactivated: 注销
|
||||
select_option_activated: 激活
|
||||
title_save_preferences: 保存偏好设定
|
||||
label_title_format: Title format
|
||||
text_title_format: "Document title format for download (%t - title, %d - date, %v- version, %i - ID, %r - revision). Example: %t_%v"
|
||||
heading_revisions: 修订版本
|
||||
title_download: 下载
|
||||
title_delete_revision: 删除此修订
|
||||
|
||||
@ -49,7 +49,7 @@ RedmineApp::Application.routes.draw do
|
||||
# dmsf_state controller
|
||||
# /projects/<project>/dmsf/state
|
||||
##
|
||||
post '/projects/:id/dmsf/state', :controller => 'dmsf_state', :action => 'user_pref_save'
|
||||
post '/projects/:id/dmsf/state', :controller => 'dmsf_state', :action => 'user_pref_save', :as => 'dmsf_user_pref_save'
|
||||
|
||||
#
|
||||
# dmsf_upload controller
|
||||
|
||||
29
db/migrate/20151209100001_title_format.rb
Normal file
29
db/migrate/20151209100001_title_format.rb
Normal file
@ -0,0 +1,29 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2015 Karel Pičman <karel.picman@kontorn.com>
|
||||
#
|
||||
# This program 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 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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 this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class TitleFormat < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :members, :title_format, :text, :null => true, :limit => 100
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :members, :title_format
|
||||
end
|
||||
end
|
||||
@ -39,10 +39,10 @@ class DmsfZip
|
||||
@zip.close if @zip
|
||||
end
|
||||
|
||||
def add_file(file, root_path = nil)
|
||||
def add_file(file, member, root_path = nil)
|
||||
string_path = file.folder.nil? ? '' : "#{file.folder.dmsf_path_str}/"
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
string_path += file.name
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
string_path += file.formatted_name(member ? member.title_format : nil)
|
||||
@zip_file.put_next_entry(string_path)
|
||||
File.open(file.last_revision.disk_file, 'rb') do |f|
|
||||
while (buffer = f.read(8192))
|
||||
@ -52,12 +52,12 @@ class DmsfZip
|
||||
@files << file
|
||||
end
|
||||
|
||||
def add_folder(folder, root_path = nil)
|
||||
def add_folder(folder, member, root_path = nil)
|
||||
string_path = "#{folder.dmsf_path_str}/"
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
@zip_file.put_next_entry(string_path)
|
||||
folder.subfolders.visible.each { |subfolder| self.add_folder(subfolder, root_path) }
|
||||
folder.files.visible.each { |file| self.add_file(file, root_path) }
|
||||
folder.files.visible.each { |file| self.add_file(file, member, root_path) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user