From f01f2f859a77ee7440bd10a82707edc9983251c4 Mon Sep 17 00:00:00 2001
From: Karel Picman
Date: Mon, 22 Jul 2013 15:37:41 +0200
Subject: [PATCH 01/12] Doc view reflecting assigned workflows that have been
deleted
---
app/views/dmsf/show.html.erb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb
index 11fb1dd0..bc4309aa 100644
--- a/app/views/dmsf/show.html.erb
+++ b/app/views/dmsf/show.html.erb
@@ -218,13 +218,15 @@
:title => l(:title_waiting_for_approval),
:remote => true) %>
<% else %>
- <%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
+ <%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
<% end %>
+ <% else %>
+ <%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
<% end %>
<% when DmsfWorkflow::STATE_APPROVED %>
<%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
<% when DmsfWorkflow::STATE_ASSIGNED %>
- <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) %>
+ <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
<%= link_to_function(image_tag('assigned.png', :plugin => :redmine_dmsf),
"manipulation_link('#{start_dmsf_workflow_path(
:id => file.last_revision.dmsf_workflow_id,
From 142f0eb2d316bd8cc9e9baecb9fc8b94a164003f Mon Sep 17 00:00:00 2001
From: root
Date: Tue, 30 Jul 2013 14:59:06 +0200
Subject: [PATCH 02/12] Wrong info 'An email was sent to %{value}' fixed
---
app/controllers/dmsf_controller.rb | 2 +-
config/locales/cs.yml | 3 +--
config/locales/de.yml | 3 +--
config/locales/en.yml | 3 +--
config/locales/es.yml | 3 +--
config/locales/fr.yml | 3 +--
config/locales/ja.yml | 3 +--
config/locales/ru.yml | 3 +--
config/locales/zh.yml | 3 +--
9 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb
index af06b2f7..936c6052 100644
--- a/app/controllers/dmsf_controller.rb
+++ b/app/controllers/dmsf_controller.rb
@@ -75,7 +75,7 @@ class DmsfController < ApplicationController
DmsfMailer.send_documents(User.current, @email_params["to"], @email_params["cc"],
@email_params["subject"], @email_params["zipped_content"], @email_params["body"]).deliver
File.delete(@email_params["zipped_content"])
- flash[:notice] = l(:notice_email_sent)
+ flash[:notice] = l(:notice_email_sent, @email_params['to'])
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
end
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 59b804b9..54465479 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -3,8 +3,7 @@ cs:
dmsf: DMSF
label_dmsf_file_plural: Dmsf soubory
warning_no_entries_selected: Není nic vybráno
- error_email_to_must_be_entered: Musí být zadán adresát
- notice_email_sent: Email byl odeslán
+ error_email_to_must_be_entered: Musí být zadán adresát
warning_file_already_locked: Soubor už je zamčen
notice_file_locked: Soubor byl zamčen
warning_file_not_locked: Soubor není zamčen
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 4b1634b6..b34b979d 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -3,8 +3,7 @@ de:
dmsf: DMS
label_dmsf_file_plural: DMS
warning_no_entries_selected: Keine Einträge ausgewählt
- error_email_to_must_be_entered: Es muss ein Email-Empfänger angegeben werden.
- notice_email_sent: Email gesendet
+ error_email_to_must_be_entered: Es muss ein Email-Empfänger angegeben werden.
warning_file_already_locked: Datei schon gesperrt
notice_file_locked: Datei gesperrt
warning_file_not_locked: Datei nicht gesperrt
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 692733f2..4f38d307 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3,8 +3,7 @@ en:
dmsf: DMSF
label_dmsf_file_plural: Dmsf files
warning_no_entries_selected: No entries selected
- error_email_to_must_be_entered: Email To must be entered
- notice_email_sent: Email sent
+ error_email_to_must_be_entered: Email To must be entered
warning_file_already_locked: File already locked
notice_file_locked: File locked
warning_file_not_locked: File not locked
diff --git a/config/locales/es.yml b/config/locales/es.yml
index fef545c9..d5c5e7c2 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -3,8 +3,7 @@ es:
dmsf: DMSF
label_dmsf_file_plural: DMSF Archivos
warning_no_entries_selected: No ha seleccionado ningún ítem
- error_email_to_must_be_entered: Ingrese un email
- notice_email_sent: Email sent
+ error_email_to_must_be_entered: Ingrese un email
warning_file_already_locked: El archivo ya está bloqueado
notice_file_locked: Archivo bloqueado
warning_file_not_locked: Archivo no bloqueado
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 16f0f84f..7de2f395 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -3,8 +3,7 @@ fr:
dmsf: DMSF
label_dmsf_file_plural: Fichiers DMSF
warning_no_entries_selected: Aucun fichier sélectionné
- error_email_to_must_be_entered: La saisie d'une adresse mail est obligatoire
- notice_email_sent: Mail envoyé
+ error_email_to_must_be_entered: La saisie d'une adresse mail est obligatoire
warning_file_already_locked: Fichier déjà verrouillé
notice_file_locked: Fichier verrouillé
warning_file_not_locked: Fichier déverrouillé
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 64447a7c..3c8101ea 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -3,8 +3,7 @@ ja:
dmsf: DMSF
label_dmsf_file_plural: Dmsf ファイル
warning_no_entries_selected: エントリーが選ばれていません
- error_email_to_must_be_entered: 電子メールの To 先は省略できません
- notice_email_sent: 電子メールを送信しました
+ error_email_to_must_be_entered: 電子メールの To 先は省略できません
warning_file_already_locked: ファイルは既にロックされています
notice_file_locked: ファイルをロックしました
warning_file_not_locked: ファイルはロックされていません
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 9c4ccc24..4f4d999e 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -3,8 +3,7 @@ ru:
dmsf: DMSF
label_dmsf_file_plural: Файлы DMSF
warning_no_entries_selected: Файлы не выбраны
- error_email_to_must_be_entered: Нужно указать, на какую почту отправить письмо
- notice_email_sent: Письмо отправлено
+ error_email_to_must_be_entered: Нужно указать, на какую почту отправить письмо
warning_file_already_locked: Файл уже заблокирован
notice_file_locked: Файл заблокирован
warning_file_not_locked: Файл не заблокирован
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 0034d3c0..e5b45007 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -3,8 +3,7 @@ zh:
dmsf: 文档管家
label_dmsf_file_plural: Dmsf files
warning_no_entries_selected: 未选择任何条目
- error_email_to_must_be_entered: 请输入电子邮件
- notice_email_sent: 邮件已发送
+ error_email_to_must_be_entered: 请输入电子邮件
warning_file_already_locked: 文件已经锁定
notice_file_locked: 文件锁定
warning_file_not_locked: 文件未锁定
From beb1ef34bab642944c5222ca12fbfcc713a157f5 Mon Sep 17 00:00:00 2001
From: Karel Picman
Date: Fri, 16 Aug 2013 09:55:27 +0200
Subject: [PATCH 03/12] Exception handling while uploading files into a locked
folder
---
app/controllers/dmsf_upload_controller.rb | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb
index 019c3f2b..78037d0f 100644
--- a/app/controllers/dmsf_upload_controller.rb
+++ b/app/controllers/dmsf_upload_controller.rb
@@ -121,8 +121,7 @@ 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)
- #new_revision.set_workflow(commited_file[:dmsf_workflow_id], nil)
+ new_revision.increase_version(commited_file["version"].to_i, true)
new_revision.mime_type = Redmine::MimeType.of(new_revision.name)
new_revision.size = File.size(commited_disk_filepath)
@@ -134,8 +133,13 @@ class DmsfUploadController < ApplicationController
end
if file.locked?
- file.unlock!
- flash[:notice] = l(:notice_file_unlocked)
+ begin
+ file.unlock!
+ flash[:notice] = l(:notice_file_unlocked)
+ rescue DmsfLockError => e
+ flash[:error] = e.message
+ next
+ end
end
# Need to save file first to generate id for it in case of creation.
From de9370961a49dfd7009fecf846aac32bc836a1e4 Mon Sep 17 00:00:00 2001
From: Karel Picman
Date: Fri, 16 Aug 2013 15:37:45 +0200
Subject: [PATCH 04/12] Email notification failures when files are locked fixed
---
app/controllers/dmsf_files_controller.rb | 2 +-
app/controllers/dmsf_files_copy_controller.rb | 4 ++--
app/models/dmsf_file.rb | 8 +++-----
app/views/dmsf_mailer/files_deleted.html.erb | 7 ++++---
app/views/dmsf_mailer/files_deleted.text.erb | 6 ++++--
.../dmsf_mailer/files_deleted.text.html.rhtml | 17 -----------------
.../dmsf_mailer/files_deleted.text.plain.rhtml | 5 -----
7 files changed, 14 insertions(+), 35 deletions(-)
delete mode 100644 app/views/dmsf_mailer/files_deleted.text.html.rhtml
delete mode 100644 app/views/dmsf_mailer/files_deleted.text.plain.rhtml
diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb
index 6b107d33..cd5430b2 100644
--- a/app/controllers/dmsf_files_controller.rb
+++ b/app/controllers/dmsf_files_controller.rb
@@ -125,7 +125,7 @@ class DmsfFilesController < ApplicationController
begin
DmsfMailer.files_updated(User.current, [@file]).deliver
rescue ActionView::MissingTemplate => e
- Rails.logger.error "Could not send email notifications: " + e
+ Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :action => "show", :id => @file
else
diff --git a/app/controllers/dmsf_files_copy_controller.rb b/app/controllers/dmsf_files_copy_controller.rb
index c1aba7f9..016d0402 100644
--- a/app/controllers/dmsf_files_copy_controller.rb
+++ b/app/controllers/dmsf_files_copy_controller.rb
@@ -72,7 +72,7 @@ class DmsfFilesCopyController < ApplicationController
begin
DmsfMailer.files_updated(User.current, [new_file]).deliver
rescue ActionView::MissingTemplate => e
- Rails.logger.error "Could not send email notifications: " + e
+ Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :controller => "dmsf_files", :action => "show", :id => new_file
@@ -110,7 +110,7 @@ class DmsfFilesCopyController < ApplicationController
# TODO: implement proper mail notification
DmsfMailer.files_updated(User.current, [@file]).deliver
rescue ActionView::MissingTemplate => e
- Rails.logger.error "Could not send email notifications: " + e
+ Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :controller => "dmsf_files", :action => "show", :id => @file
diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb
index 6fd87643..ca5b7461 100644
--- a/app/models/dmsf_file.rb
+++ b/app/models/dmsf_file.rb
@@ -125,7 +125,7 @@ class DmsfFile < ActiveRecord::Base
end
def title
- self.last_revision.title
+ self.last_revision ? self.last_revision.title : self.name
end
def description
@@ -150,10 +150,8 @@ class DmsfFile < ActiveRecord::Base
path
end
- def dmsf_path_str
- path = self.dmsf_path
- string_path = path.map { |element| element.title }
- string_path.join("/")
+ def dmsf_path_str
+ self.dmsf_path.map { |element| element.title }.join('/')
end
def notify?
diff --git a/app/views/dmsf_mailer/files_deleted.html.erb b/app/views/dmsf_mailer/files_deleted.html.erb
index 6c930a4e..f0eb6fe0 100644
--- a/app/views/dmsf_mailer/files_deleted.html.erb
+++ b/app/views/dmsf_mailer/files_deleted.html.erb
@@ -8,9 +8,10 @@
deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
- <%= h(file.dmsf_path_str) %> (<%= file.name %>),
- <%= number_to_human_size(file.last_revision.size) %>,
- version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
+ <%= h(file.dmsf_path_str) %> (<%= file.name %>)
+ <% if file.last_revision %>
+ , <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
+ <% end %>
<% end %>
- User <%= link_to(h(@user), {:only_path => false, :controller => "users", :action => "show", :id => @user }) %>
- deleted DMSF files in project <%= @project.name %>:
- <% @files.each do |file| %>
-
- <%= h(file.dmsf_path_str) %> (<%= file.name %>),
- <%= number_to_human_size(file.last_revision.size) %>,
- version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
-
- <% end %>
-
diff --git a/app/views/dmsf_mailer/files_deleted.text.erb b/app/views/dmsf_mailer/files_deleted.text.erb
index 52905590..fd6fcbb5 100644
--- a/app/views/dmsf_mailer/files_deleted.text.erb
+++ b/app/views/dmsf_mailer/files_deleted.text.erb
@@ -1,5 +1,7 @@
User <%= @user %> deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
- <%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
-
+ <%= file.dmsf_path_str %> (<%= file.name %>)
+ <% if file.last_revision %>
+ , <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/dmsf_mailer/files_deleted.text.html.rhtml b/app/views/dmsf_mailer/files_deleted.text.html.rhtml
deleted file mode 100644
index 6c930a4e..00000000
--- a/app/views/dmsf_mailer/files_deleted.text.html.rhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-