From f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang
Date: Fri, 5 Sep 2008 10:31:06 +0000
Subject: [PATCH] Merged hooks branch @ r1785 into trunk.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1786 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
app/controllers/issues_controller.rb | 1 +
app/helpers/issues_helper.rb | 3 +-
app/views/issues/_form.rhtml | 2 +
app/views/issues/bulk_edit.rhtml | 1 +
app/views/issues/show.rhtml | 1 +
app/views/layouts/base.rhtml | 7 +-
app/views/projects/settings/_members.rhtml | 2 +
app/views/versions/show.rhtml | 2 +
lib/generators/redmine_plugin/USAGE | 18 +++
.../redmine_plugin_generator.rb | 31 +++++
.../redmine_plugin/templates/README | 3 +
.../redmine_plugin/templates/en.yml | 2 +
.../redmine_plugin/templates/init.rb | 8 ++
.../redmine_plugin/templates/test_helper.rb | 5 +
.../redmine_plugin_controller/USAGE | 5 +
.../redmine_plugin_controller_generator.rb | 18 +++
.../templates/controller.rb | 7 ++
.../templates/functional_test.rb | 8 ++
.../templates/helper.rb | 2 +
.../templates/view.html.erb | 1 +
lib/generators/redmine_plugin_model/USAGE | 5 +
.../redmine_plugin_model_generator.rb | 18 +++
.../templates/fixtures.yml | 11 ++
.../templates/migration.rb | 13 +++
.../redmine_plugin_model/templates/model.rb | 2 +
.../templates/unit_test.rb | 10 ++
lib/redmine.rb | 1 +
lib/redmine/hook.rb | 109 ++++++++++++++++++
lib/tasks/plugins.rake | 38 ++++++
test/functional/projects_controller_test.rb | 19 +++
test/unit/lib/redmine/hook_test.rb | 83 +++++++++++++
31 files changed, 432 insertions(+), 4 deletions(-)
create mode 100644 lib/generators/redmine_plugin/USAGE
create mode 100644 lib/generators/redmine_plugin/redmine_plugin_generator.rb
create mode 100644 lib/generators/redmine_plugin/templates/README
create mode 100644 lib/generators/redmine_plugin/templates/en.yml
create mode 100644 lib/generators/redmine_plugin/templates/init.rb
create mode 100644 lib/generators/redmine_plugin/templates/test_helper.rb
create mode 100644 lib/generators/redmine_plugin_controller/USAGE
create mode 100644 lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
create mode 100644 lib/generators/redmine_plugin_controller/templates/controller.rb
create mode 100644 lib/generators/redmine_plugin_controller/templates/functional_test.rb
create mode 100644 lib/generators/redmine_plugin_controller/templates/helper.rb
create mode 100644 lib/generators/redmine_plugin_controller/templates/view.html.erb
create mode 100644 lib/generators/redmine_plugin_model/USAGE
create mode 100644 lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb
create mode 100644 lib/generators/redmine_plugin_model/templates/fixtures.yml
create mode 100644 lib/generators/redmine_plugin_model/templates/migration.rb
create mode 100644 lib/generators/redmine_plugin_model/templates/model.rb
create mode 100644 lib/generators/redmine_plugin_model/templates/unit_test.rb
create mode 100644 lib/redmine/hook.rb
create mode 100644 lib/tasks/plugins.rake
create mode 100644 test/unit/lib/redmine/hook_test.rb
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 3f7723226..7d572924f 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -233,6 +233,7 @@ class IssuesController < ApplicationController
issue.start_date = params[:start_date] unless params[:start_date].blank?
issue.due_date = params[:due_date] unless params[:due_date].blank?
issue.done_ratio = params[:done_ratio] unless params[:done_ratio].blank?
+ call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
# Don't save any change to the issue if the user is not authorized to apply the requested status
if (status.nil? || (issue.status.new_status_allowed_to?(status, current_role, issue.tracker) && issue.status = status)) && issue.save
# Send notification for each issue (if changed)
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index c6de00c10..43acabd19 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -89,7 +89,8 @@ module IssuesHelper
when 'attachment'
label = l(:label_attachment)
end
-
+ call_hook(:helper_issues_show_detail_after_setting, {:detail => detail, :label => label, :value => value, :old_value => old_value })
+
label ||= detail.prop_key
value ||= detail.value
old_value ||= detail.old_value
diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml
index 4eca3cb4a..419536fee 100644
--- a/app/views/issues/_form.rhtml
+++ b/app/views/issues/_form.rhtml
@@ -48,4 +48,6 @@
<%= render :partial => 'attachments/form' %>
<% end %>
+<%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
+
<%= wikitoolbar_for 'issue_description' %>
diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml
index 86bc76765..b916cf092 100644
--- a/app/views/issues/bulk_edit.rhtml
+++ b/app/views/issues/bulk_edit.rhtml
@@ -38,6 +38,7 @@
+<%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>