メール配信 {{include()}} マクロ

155 views
Skip to first unread message

KEI

unread,
May 11, 2012, 11:39:23 AM5/11/12
to redmine-...@googlegroups.com
みなさん
こんばんわ。

Redmineを使用しています。
メール配信における{{include()}}について質問があります。

チケット更新時のメール配信で、チケット更新内容で{{include()}}を使用して
Wikiをインクルードしようとすると、メールの配信内容では、マクロエラーになってしまい、
メールでincludeしたwiki内容が閲覧できません。

この問題について、どのように解決したらよいか、知っている方、
アドバイスをお願いします。

使用しているRedmine バージョンは、1.1.2です。

以上、よろしくお願いします。

nobu_toyofuku

unread,
May 16, 2012, 12:33:20 AM5/16/12
to redmine-...@googlegroups.com
豊福です。

2012年5月12日 0:39 KEI <kei.s...@gmail.com>:
> チケット更新時のメール配信で、チケット更新内容で{{include()}}を使用して
> Wikiをインクルードしようとすると、メールの配信内容では、マクロエラーになってしまい、
> メールでincludeしたwiki内容が閲覧できません。

最適な直し方なのか自信がないですが取りあえず redmine-1.3.2 では以下のパッチでうまくいきました。

--- lib/redmine/wiki_formatting/macros.rb.or
+++ lib/redmine/wiki_formatting/macros.rb
@@ -20,5 +20,6 @@
module Macros
module Definitions
- def exec_macro(name, obj, args)
+ def exec_macro(name, obj, args, project=nil)
+ @project ||= project
method_name = "macro_#{name}"
send(method_name, obj, args) if respond_to?(method_name)
--- app/helpers/application_helper.rb.org
+++ app/helpers/application_helper.rb
@@ -810,5 +810,5 @@
if esc.nil?
begin
- exec_macro(macro, obj, args)
+ exec_macro(macro, obj, args, project)
rescue => e
"<div class=\"flash error\">Error executing the
<strong>#{macro}</strong> macro (#{e})</div>"

> 使用しているRedmine バージョンは、1.1.2です。

実際に 1.1.2 で試していないのですが上記と同じ方法だと

--- lib/redmine/wiki_formatting/macros.rb.org
+++ lib/redmine/wiki_formatting/macros.rb
@@ -20,5 +20,6 @@
module Macros
module Definitions
- def exec_macro(name, obj, args)
+ def exec_macro(name, obj, args, project=nil)
+ @project ||= project
method_name = "macro_#{name}"
send(method_name, obj, args) if respond_to?(method_name)
--- app/helpers/application_helper.rb.org
+++ app/helpers/application_helper.rb
@@ -451,5 +451,5 @@
only_path = options.delete(:only_path) == false ? false : true

- text = Redmine::WikiFormatting.to_html(Setting.text_formatting,
text, :object => obj, :attribute => attr) { |macro, args|
exec_macro(macro, obj, args) }
+ text = Redmine::WikiFormatting.to_html(Setting.text_formatting,
text, :object => obj, :attribute => attr) { |macro, args|
exec_macro(macro, obj, args, project) }

@parsed_headings = []

でいけるのではないかと思います。
---

KEI

unread,
May 16, 2012, 10:03:38 AM5/16/12
to redmine-...@googlegroups.com
KEIです。

返信ありがとうございます。
早速試したところ、期待通りの結果となりました。
アドバイスありがとうございました。

2012年5月16日水曜日 13時33分20秒 UTC+9 nobu_toyofuku:
 豊福です。
Reply all
Reply to author
Forward
0 new messages