Actual changes...
This commit is contained in:
parent
835d02aedf
commit
ae73ed64cd
@ -75,8 +75,8 @@ class DmsfController < ApplicationController
|
||||
render :action => "email_entries"
|
||||
return
|
||||
end
|
||||
DmsfMailer.deliver_send_documents(User.current, @email_params["to"], @email_params["cc"],
|
||||
@email_params["subject"], @email_params["zipped_content"], @email_params["body"])
|
||||
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)
|
||||
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
|
||||
@ -129,7 +129,7 @@ class DmsfController < ApplicationController
|
||||
end
|
||||
unless deleted_files.empty?
|
||||
deleted_files.each {|f| log_activity(f, "deleted")}
|
||||
DmsfMailer.deliver_files_deleted(User.current, deleted_files)
|
||||
DmsfMailer.files_deleted(User.current, deleted_files).deliver
|
||||
end
|
||||
if failed_entries.empty?
|
||||
flash[:notice] = l(:notice_entries_deleted)
|
||||
|
||||
@ -120,7 +120,7 @@ class DmsfFilesController < ApplicationController
|
||||
flash[:notice] = (flash[:notice].nil? ? "" : flash[:notice]) + l(:notice_file_revision_created)
|
||||
log_activity("new revision")
|
||||
begin
|
||||
DmsfMailer.deliver_files_updated(User.current, [@file])
|
||||
DmsfMailer.files_updated(User.current, [@file]).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: " + e
|
||||
end
|
||||
@ -136,7 +136,7 @@ class DmsfFilesController < ApplicationController
|
||||
if @file.delete
|
||||
flash[:notice] = l(:notice_file_deleted)
|
||||
log_activity("deleted")
|
||||
DmsfMailer.deliver_files_deleted(User.current, [@file])
|
||||
DmsfMailer.files_deleted(User.current, [@file]).deliver
|
||||
else
|
||||
flash[:error] = l(:error_file_is_locked)
|
||||
end
|
||||
|
||||
@ -72,7 +72,7 @@ class DmsfFilesCopyController < ApplicationController
|
||||
flash[:notice] = l(:notice_file_copied)
|
||||
log_activity(new_file, "was copied (is copy)")
|
||||
begin
|
||||
DmsfMailer.deliver_files_updated(User.current, [new_file])
|
||||
DmsfMailer.files_updated(User.current, [new_file]).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: " + e
|
||||
end
|
||||
@ -110,7 +110,7 @@ class DmsfFilesCopyController < ApplicationController
|
||||
log_activity(@file, "was moved (is copy)")
|
||||
begin
|
||||
# TODO: implement proper mail notification
|
||||
DmsfMailer.deliver_files_updated(User.current, [@file])
|
||||
DmsfMailer.files_updated(User.current, [@file]).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: " + e
|
||||
end
|
||||
|
||||
@ -74,7 +74,7 @@ class DmsfFoldersCopyController < ApplicationController
|
||||
|
||||
#TODO: implement proper notification for all new files
|
||||
#begin
|
||||
# DmsfMailer.deliver_files_updated(User.current, [new_file])
|
||||
# DmsfMailer.files_updated(User.current, [new_file]).deliver
|
||||
#rescue ActionView::MissingTemplate => e
|
||||
# Rails.logger.error "Could not send email notifications: " + e
|
||||
#end
|
||||
|
||||
@ -158,7 +158,7 @@ class DmsfUploadController < ApplicationController
|
||||
unless files.empty?
|
||||
files.each {|file| log_activity(file, "uploaded")}
|
||||
begin
|
||||
DmsfMailer.deliver_files_updated(User.current, files)
|
||||
DmsfMailer.files_updated(User.current, files).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: " + e
|
||||
end
|
||||
|
||||
@ -25,11 +25,13 @@ class DmsfMailer < Mailer
|
||||
files = files.select { |file| file.notify? }
|
||||
|
||||
redmine_headers "Project" => project.identifier
|
||||
recipients get_notify_user_emails(user, files)
|
||||
subject project.name + ": Dmsf files updated"
|
||||
body :user => user, :files => files, :project => project
|
||||
# TODO: correct way should be render_multipart("files_updated", body), but other plugin broke it
|
||||
render_multipart(File.expand_path(File.dirname(__FILE__) + "/../views/dmsf_mailer/" + "files_updated"), body)
|
||||
|
||||
@user = user
|
||||
@files = files
|
||||
@project = project
|
||||
|
||||
mail :to => get_notify_user_emails(user, files),
|
||||
:subject => project.name + ": Dmsf files updated"
|
||||
end
|
||||
|
||||
def files_deleted(user, files)
|
||||
@ -37,31 +39,23 @@ class DmsfMailer < Mailer
|
||||
files = files.select { |file| file.notify? }
|
||||
|
||||
redmine_headers "Project" => project.identifier
|
||||
recipients get_notify_user_emails(user, files)
|
||||
subject project.name + ": Dmsf files deleted"
|
||||
body :user => user, :files => files, :project => project
|
||||
# TODO: correct way should be render_multipart("files_updated", body), but other plugin broke it
|
||||
render_multipart(File.expand_path(File.dirname(__FILE__) + "/../views/dmsf_mailer/" + "files_deleted"), body)
|
||||
|
||||
@user = user
|
||||
@files = files
|
||||
@project = project
|
||||
|
||||
mail :to => get_notify_user_emails(user, files),
|
||||
:subject => project.name + ": Dmsf files deleted"
|
||||
end
|
||||
|
||||
def send_documents(user, email_to, email_cc, email_subject, zipped_content, email_plain_body)
|
||||
recipients email_to
|
||||
if !email_cc.strip.blank?
|
||||
cc email_cc
|
||||
end
|
||||
subject email_subject
|
||||
from user.mail
|
||||
content_type "multipart/mixed"
|
||||
|
||||
part "text/plain" do |p|
|
||||
p.body = email_plain_body
|
||||
end
|
||||
|
||||
debugger
|
||||
zipped_content_data = open(zipped_content, "rb") {|io| io.read }
|
||||
|
||||
attachment :content_type => "application/zip",
|
||||
:filename => "Documents.zip",
|
||||
:body => zipped_content_data
|
||||
@body = email_plain_body
|
||||
|
||||
attachments['Documents.zip'] = {:content_type => "application/zip", :content => zipped_content_data}
|
||||
mail(:to => email_to, :cc => email_cc, :subject => email_subject, :from => user.mail)
|
||||
end
|
||||
|
||||
private
|
||||
@ -92,7 +86,8 @@ class DmsfMailer < Mailer
|
||||
else
|
||||
false
|
||||
end
|
||||
else
notify_member.dmsf_mail_notification
|
||||
else
|
||||
notify_member.dmsf_mail_notification
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
<h3><%= l(:heading_send_documents_by_email) %></h3>
|
||||
|
||||
<% form_tag({:action => "entries_email", :id => @project, :folder_id => @folder},
|
||||
<%= form_tag({:action => "entries_email", :id => @project, :folder_id => @folder},
|
||||
{ :method=>:post, :class => "tabular"}) do %>
|
||||
<div class="box">
|
||||
<p>
|
||||
|
||||
@ -1 +1 @@
|
||||
<%= ApplicationHelper.simple_format(@body) %>
|
||||
<%= simple_format(@body) %>
|
||||
|
||||
@ -35,6 +35,7 @@ RedmineApp::Application.routes.draw do
|
||||
post '/projects/:id/dmsf/save/root', :controller => 'dmsf', :action => 'save_root'
|
||||
post '/projects/:id/dmsf/entries', :controller => 'dmsf', :action => 'entries_operation'
|
||||
post '/projects/:id/dmsf/entries/delete', :controller => 'dmsf', :action => 'delete_entries'
|
||||
post '/projects/:id/dmsf/entries/email', :controller => 'dmsf', :action => 'entries_email'
|
||||
get '/projects/:id/dmsf/', :controller => 'dmsf', :action => 'show'
|
||||
get '/projects/:id/dmsf/new', :controller => 'dmsf', :action => 'new'
|
||||
get '/projects/:id/dmsf/edit', :controller=> 'dmsf', :action => 'edit'
|
||||
|
||||
@ -4,3 +4,6 @@ require 'redmine_dmsf/patches/project_patch'
|
||||
|
||||
module RedmineDmsf
|
||||
end
|
||||
|
||||
#Add plugin's view folder into ActionMailer's paths to search
|
||||
ActionMailer::Base.append_view_path(File.expand_path(File.dirname(__FILE__) + '/../app/views'))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user