From 33ce8af0f2b8515c0b06690bc245bf19baa3b0fd Mon Sep 17 00:00:00 2001 From: Tatsuya Saito Date: Wed, 7 Sep 2011 10:33:59 +0900 Subject: [PATCH 1/2] Added issues history export by Karel Picman http://www.redmine.org/boards/3/topics/11986?r=26041#message-26041 --- .../settings/_xls_export_settings.html.erb | 2 +- config/locales/bg.yml | 3 ++ config/locales/cs.yml | 3 ++ config/locales/de.yml | 3 ++ config/locales/en.yml | 3 ++ config/locales/ja.yml | 3 ++ config/locales/ru.yml | 3 ++ config/locales/zh.yml | 3 ++ init.rb | 1 + lib/xls_export.rb | 29 +++++++++++++++++-- 10 files changed, 50 insertions(+), 3 deletions(-) diff --git a/app/views/settings/_xls_export_settings.html.erb b/app/views/settings/_xls_export_settings.html.erb index d609352..d7237b4 100644 --- a/app/views/settings/_xls_export_settings.html.erb +++ b/app/views/settings/_xls_export_settings.html.erb @@ -1,5 +1,5 @@ -<% fields_all = [['relations','watchers','description', 'time','attachments' ], ['query_columns_only','group','generate_name'] ] %> +<% fields_all = [['relations','watchers','description', 'history', 'time','attachments' ], ['query_columns_only','group','generate_name'] ] %> <% fields_all.each do |c|%>

<% c.each do |fnm| -%> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 949437b..1b9983b 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -2,6 +2,7 @@ bg: label_plugin_xlse_relations: "Експорт на връзките" label_plugin_xlse_watchers: "Експорт на наблюдателите" label_plugin_xlse_description: "Експорт на описанията" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "Експорт на употребеното време" label_plugin_xlse_attachments: "Списък на прикачените файлове" label_plugin_xlse_query_columns_only: "Експорт само на избраните колони" @@ -22,3 +23,5 @@ bg: label_plugin_xlse_export_format_quick_tooltip: "Експортиране с опции по подразбиране" label_plugin_xlse_export_format_detailed: "Подробно" label_plugin_xlse_export_format_detailed_tooltip: "Избор на опции преди експортиране" + + field_history: "History" diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 35a9a34..c9f7dbd 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -2,6 +2,7 @@ cs: label_plugin_xlse_relations: "Exportovat vazby" label_plugin_xlse_watchers: "Exportovat sledování" label_plugin_xlse_description: "Exportovat popis" + label_plugin_xlse_history: "Exportovat historii" label_plugin_xlse_time: "Exportovat strávený čas" label_plugin_xlse_attachments: "Vypsat přílohy" label_plugin_xlse_query_columns_only: "Exportovat pouze zvolené sloupce" @@ -17,3 +18,5 @@ cs: label_plugin_xlse_field_attachment: "Přílohy" + field_history: "Historie" + diff --git a/config/locales/de.yml b/config/locales/de.yml index 2ec7704..624d3cb 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -2,6 +2,7 @@ de: label_plugin_xlse_relations: "Ticket-Beziehnungen exportieren" label_plugin_xlse_watchers: "Beobachter exportieren" label_plugin_xlse_description: "Beschreibungen exportieren" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "Aufgewendete Zeit exportieren" label_plugin_xlse_attachments: "Anhänge auflisten" label_plugin_xlse_query_columns_only: "Nur ausgewählte Spalten exportieren" @@ -22,3 +23,5 @@ de: label_plugin_xlse_export_format_quick_tooltip: "Exportiere mit Standard Einstellungen" label_plugin_xlse_export_format_detailed: "Detailierter Export" label_plugin_xlse_export_format_detailed_tooltip: "Wähle Export Optionen" + + field_history: "Historie" diff --git a/config/locales/en.yml b/config/locales/en.yml index 4729c16..5d49818 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,6 +2,7 @@ en: label_plugin_xlse_relations: "Export relations" label_plugin_xlse_watchers: "Export watchers" label_plugin_xlse_description: "Export description" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "Export spent time" label_plugin_xlse_attachments: "List attachments" label_plugin_xlse_query_columns_only: "Export selected columns only" @@ -22,4 +23,6 @@ en: label_plugin_xlse_export_format_quick_tooltip: "Export using default settings" label_plugin_xlse_export_format_detailed: "Detailed" label_plugin_xlse_export_format_detailed_tooltip: "Choose options before export" + + field_history: "History" diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 1105410..4bd58c9 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -2,6 +2,7 @@ ja: label_plugin_xlse_relations: "関連を出力" label_plugin_xlse_watchers: "ウォッチャーを出力" label_plugin_xlse_description: "説明を出力" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "作業時間を出力" label_plugin_xlse_attachments: "添付ファイルのリストを出力" label_plugin_xlse_query_columns_only: "選択した列だけを出力" @@ -22,4 +23,6 @@ ja: label_plugin_xlse_export_format_quick_tooltip: "標準の設定で出力する" label_plugin_xlse_export_format_detailed: "オプション" label_plugin_xlse_export_format_detailed_tooltip: "オプションを指定して出力する" + + field_history: "History" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index b0d0759..d7f1178 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,6 +2,7 @@ ru: label_plugin_xlse_relations: "Экспортировать отношения" label_plugin_xlse_watchers: "Экспортировать наблюдатeлей" label_plugin_xlse_description: "Экспортировать описания" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "Экспортировать затраченное время" label_plugin_xlse_attachments: "Список вложений" label_plugin_xlse_query_columns_only: "Экспортировать только выделенные поля" @@ -22,3 +23,5 @@ ru: label_plugin_xlse_export_format_quick_tooltip: "Сохранить в XLSб используя значения по умолчанию" label_plugin_xlse_export_format_detailed: "Подробный" label_plugin_xlse_export_format_detailed_tooltip: "Выбрать опции перед сохранением в XLS" + + field_history: "исто́рия" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ca56e72..253e9a7 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2,6 +2,7 @@ zh: label_plugin_xlse_relations: "导出关系" label_plugin_xlse_watchers: "导出跟踪者" label_plugin_xlse_description: "导出描述" + label_plugin_xlse_history: "Export history" label_plugin_xlse_time: "导出耗时" label_plugin_xlse_attachments: "列出附件" label_plugin_xlse_query_columns_only: "仅导出选中" @@ -21,3 +22,5 @@ zh: label_plugin_xlse_export_format_quick_tooltip: "使用默认设置导出" label_plugin_xlse_export_format_detailed: "详情" label_plugin_xlse_export_format_detailed_tooltip: "导出之前选择配置" + + field_history: "History" diff --git a/init.rb b/init.rb index d98aee4..e210071 100644 --- a/init.rb +++ b/init.rb @@ -28,6 +28,7 @@ 'relations' => '1', 'watchers' => '1', 'description' => '1', + 'history' => '0', 'time' => '0', 'attachments' => '0', 'query_columns_only' => '0', diff --git a/lib/xls_export.rb b/lib/xls_export.rb index c3f5c8a..a9305eb 100644 --- a/lib/xls_export.rb +++ b/lib/xls_export.rb @@ -40,6 +40,7 @@ module XLS # :watchers - export watchers # :time - export time spent # :description - export descriptions +# :history - export history # :attachments - export attachments info # :query_columns_only - export only columns from actual query # :group - group by query grouping @@ -52,6 +53,7 @@ def issues_to_xls2(issues, project, query, options = {}) show_watchers = options[:watchers] show_time = options[:time] show_descr = options[:description] + show_hist = options[:history] query_columns_only = options[:query_columns_only] show_attachment = options[:attachments] group_by_query = query.grouped? ? options[:group] : false @@ -81,7 +83,11 @@ def issues_to_xls2(issues, project, query, options = {}) if show_descr == '1' issue_columns << QueryColumn.new(:description) - end + end + + if show_hist == '1' + issue_columns << QueryColumn.new(:history) + end sheet1 = nil group = false @@ -151,6 +157,25 @@ def issues_to_xls2(issues, project, query, options = {}) end end descr_str + when :history + hist_str = '' + issue_updates = issue.journals.find( + :all, :include => [:user, :details], + :order => "#{Journal.table_name}.created_on ASC") + for journal in issue_updates + hist_str << format_time(journal.created_on) + " - " + journal.user.name + hist_str << "\n" + for detail in journal.details + hist_str << " - " + show_detail(detail, true) + hist_str << "\n" unless detail == journal.details.last + end + if journal.notes? + hist_str << "\n" unless journal.details.empty? + hist_str << journal.notes.to_s + end + hist_str << "\n" unless journal == issue_updates.last + end + hist_str when :formatted_relations rel_str = '' relations = issue.relations.select {|r| r.other_issue(issue).visible?} @@ -186,7 +211,7 @@ def issues_to_xls2(issues, project, query, options = {}) end end - value = ['Time', 'Date', 'Fixnum', 'Float', 'Integer', 'String'].include?(v.class.name) ? v : v.to_s + value = ['Time', 'Date', 'Fixnum', 'Float', 'Integer', 'String', 'String'].include?(v.class.name) ? v : v.to_s lf_pos = get_value_width(value) columns_width[j+1] = lf_pos unless columns_width[j+1] >= lf_pos From 447170aa8799a7ce1d709af1022905d29a77ea10 Mon Sep 17 00:00:00 2001 From: Tatsuya Saito Date: Wed, 7 Sep 2011 10:57:34 +0900 Subject: [PATCH 2/2] Added and fixed issues history export's translations. --- config/locales/bg.yml | 4 ++-- config/locales/de.yml | 2 +- config/locales/ja.yml | 4 ++-- config/locales/pl.yml | 2 ++ config/locales/pt-BR.yml | 3 +++ config/locales/ru.yml | 4 ++-- config/locales/zh-TW.yml | 3 +++ config/locales/zh.yml | 4 ++-- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 1b9983b..c53b986 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -2,7 +2,7 @@ bg: label_plugin_xlse_relations: "Експорт на връзките" label_plugin_xlse_watchers: "Експорт на наблюдателите" label_plugin_xlse_description: "Експорт на описанията" - label_plugin_xlse_history: "Export history" + label_plugin_xlse_history: "износ история" label_plugin_xlse_time: "Експорт на употребеното време" label_plugin_xlse_attachments: "Списък на прикачените файлове" label_plugin_xlse_query_columns_only: "Експорт само на избраните колони" @@ -24,4 +24,4 @@ bg: label_plugin_xlse_export_format_detailed: "Подробно" label_plugin_xlse_export_format_detailed_tooltip: "Избор на опции преди експортиране" - field_history: "History" + field_history: "история" diff --git a/config/locales/de.yml b/config/locales/de.yml index 624d3cb..dd0b74d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -2,7 +2,7 @@ de: label_plugin_xlse_relations: "Ticket-Beziehnungen exportieren" label_plugin_xlse_watchers: "Beobachter exportieren" label_plugin_xlse_description: "Beschreibungen exportieren" - label_plugin_xlse_history: "Export history" + label_plugin_xlse_history: "Historie exportieren" label_plugin_xlse_time: "Aufgewendete Zeit exportieren" label_plugin_xlse_attachments: "Anhänge auflisten" label_plugin_xlse_query_columns_only: "Nur ausgewählte Spalten exportieren" diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 4bd58c9..8a62098 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -2,7 +2,7 @@ ja: label_plugin_xlse_relations: "関連を出力" label_plugin_xlse_watchers: "ウォッチャーを出力" label_plugin_xlse_description: "説明を出力" - label_plugin_xlse_history: "Export history" + label_plugin_xlse_history: "履歴を出力" label_plugin_xlse_time: "作業時間を出力" label_plugin_xlse_attachments: "添付ファイルのリストを出力" label_plugin_xlse_query_columns_only: "選択した列だけを出力" @@ -24,5 +24,5 @@ ja: label_plugin_xlse_export_format_detailed: "オプション" label_plugin_xlse_export_format_detailed_tooltip: "オプションを指定して出力する" - field_history: "History" + field_history: "履歴" diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 4f534f4..fa3e3cc 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -4,6 +4,7 @@ pl: label_plugin_xlse_relations: "Eksportuj powiązania" label_plugin_xlse_watchers: "Eksportuj obserwatorów" label_plugin_xlse_description: "Eksportuj opis" + label_plugin_xlse_history: "Eksportuj Historia" label_plugin_xlse_time: "Eksportuj dziennik" label_plugin_xlse_attachments: "Ekportuj listę załączników" label_plugin_xlse_query_columns_only: "Eksportuj tylko zaznaczone kolumny" @@ -25,3 +26,4 @@ pl: label_plugin_xlse_export_format_detailed: "Szczegółowy" label_plugin_xlse_export_format_detailed_tooltip: "Ustaw opcje przed eksportem" + field_history: "Historia" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index af1fec6..d83f364 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -2,6 +2,7 @@ pt-BR: label_plugin_xlse_relations: "Exportar tarefas relacionadas" label_plugin_xlse_watchers: "Exportar observadores" label_plugin_xlse_description: "Exportar descrição" + label_plugin_xlse_history: "Exportar história" label_plugin_xlse_time: "Exportar tempo de trabalho" label_plugin_xlse_attachments: "Listar anexos" label_plugin_xlse_query_columns_only: "Exportar apenas as colunas selecionadas" @@ -22,3 +23,5 @@ pt-BR: label_plugin_xlse_export_format_quick_tooltip: "Exportar usando as configurações padrão" label_plugin_xlse_export_format_detailed: "Detalhado" label_plugin_xlse_export_format_detailed_tooltip: "Escolher as opções antes da exportação" + + field_history: "história" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d7f1178..5c63afb 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,7 +2,7 @@ ru: label_plugin_xlse_relations: "Экспортировать отношения" label_plugin_xlse_watchers: "Экспортировать наблюдатeлей" label_plugin_xlse_description: "Экспортировать описания" - label_plugin_xlse_history: "Export history" + label_plugin_xlse_history: "Экспортировать История" label_plugin_xlse_time: "Экспортировать затраченное время" label_plugin_xlse_attachments: "Список вложений" label_plugin_xlse_query_columns_only: "Экспортировать только выделенные поля" @@ -24,4 +24,4 @@ ru: label_plugin_xlse_export_format_detailed: "Подробный" label_plugin_xlse_export_format_detailed_tooltip: "Выбрать опции перед сохранением в XLS" - field_history: "исто́рия" + field_history: "История" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 54c76e8..c906578 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -2,6 +2,7 @@ zh-TW: label_plugin_xlse_relations: "導出關係" label_plugin_xlse_watchers: "導出跟蹤者" label_plugin_xlse_description: "導出描述" + label_plugin_xlse_history: "導出歷史" label_plugin_xlse_time: "導出耗時" label_plugin_xlse_attachments: "列出附件" label_plugin_xlse_query_columns_only: "僅導出選中" @@ -21,3 +22,5 @@ zh-TW: label_plugin_xlse_export_format_quick_tooltip: "使用預設設置導出" label_plugin_xlse_export_format_detailed: "詳情" label_plugin_xlse_export_format_detailed_tooltip: "導出之前選擇配置" + + field_history: "歷史" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 253e9a7..8136f5f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2,7 +2,7 @@ zh: label_plugin_xlse_relations: "导出关系" label_plugin_xlse_watchers: "导出跟踪者" label_plugin_xlse_description: "导出描述" - label_plugin_xlse_history: "Export history" + label_plugin_xlse_history: "导出历史记录" label_plugin_xlse_time: "导出耗时" label_plugin_xlse_attachments: "列出附件" label_plugin_xlse_query_columns_only: "仅导出选中" @@ -23,4 +23,4 @@ zh: label_plugin_xlse_export_format_detailed: "详情" label_plugin_xlse_export_format_detailed_tooltip: "导出之前选择配置" - field_history: "History" + field_history: "历史记录"