@@ -1,92 +1,92 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class AdminController < ApplicationController |
|
18 | class AdminController < ApplicationController | |
19 | before_filter :require_admin |
|
19 | before_filter :require_admin | |
20 |
|
20 | |||
21 | helper :sort |
|
21 | helper :sort | |
22 | include SortHelper |
|
22 | include SortHelper | |
23 |
|
23 | |||
24 | def index |
|
24 | def index | |
25 | @no_configuration_data = Redmine::DefaultData::Loader::no_data? |
|
25 | @no_configuration_data = Redmine::DefaultData::Loader::no_data? | |
26 | end |
|
26 | end | |
27 |
|
27 | |||
28 | def projects |
|
28 | def projects | |
29 | sort_init 'name', 'asc' |
|
29 | sort_init 'name', 'asc' | |
30 | sort_update |
|
30 | sort_update | |
31 |
|
31 | |||
32 | @status = params[:status] ? params[:status].to_i : 1 |
|
32 | @status = params[:status] ? params[:status].to_i : 1 | |
33 | c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) |
|
33 | c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) | |
34 |
|
34 | |||
35 | unless params[:name].blank? |
|
35 | unless params[:name].blank? | |
36 | name = "%#{params[:name].strip.downcase}%" |
|
36 | name = "%#{params[:name].strip.downcase}%" | |
37 | c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] |
|
37 | c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | @project_count = Project.count(:conditions => c.conditions) |
|
40 | @project_count = Project.count(:conditions => c.conditions) | |
41 | @project_pages = Paginator.new self, @project_count, |
|
41 | @project_pages = Paginator.new self, @project_count, | |
42 | per_page_option, |
|
42 | per_page_option, | |
43 | params['page'] |
|
43 | params['page'] | |
44 | @projects = Project.find :all, :order => sort_clause, |
|
44 | @projects = Project.find :all, :order => sort_clause, | |
45 | :conditions => c.conditions, |
|
45 | :conditions => c.conditions, | |
46 | :limit => @project_pages.items_per_page, |
|
46 | :limit => @project_pages.items_per_page, | |
47 | :offset => @project_pages.current.offset |
|
47 | :offset => @project_pages.current.offset | |
48 |
|
48 | |||
49 | render :action => "projects", :layout => false if request.xhr? |
|
49 | render :action => "projects", :layout => false if request.xhr? | |
50 | end |
|
50 | end | |
51 |
|
51 | |||
52 | def plugins |
|
52 | def plugins | |
53 | @plugins = Redmine::Plugin.registered_plugins |
|
53 | @plugins = Redmine::Plugin.registered_plugins.values.sort | |
54 | end |
|
54 | end | |
55 |
|
55 | |||
56 | # Loads the default configuration |
|
56 | # Loads the default configuration | |
57 | # (roles, trackers, statuses, workflow, enumerations) |
|
57 | # (roles, trackers, statuses, workflow, enumerations) | |
58 | def default_configuration |
|
58 | def default_configuration | |
59 | if request.post? |
|
59 | if request.post? | |
60 | begin |
|
60 | begin | |
61 | Redmine::DefaultData::Loader::load(params[:lang]) |
|
61 | Redmine::DefaultData::Loader::load(params[:lang]) | |
62 | flash[:notice] = l(:notice_default_data_loaded) |
|
62 | flash[:notice] = l(:notice_default_data_loaded) | |
63 | rescue Exception => e |
|
63 | rescue Exception => e | |
64 | flash[:error] = l(:error_can_t_load_default_data, e.message) |
|
64 | flash[:error] = l(:error_can_t_load_default_data, e.message) | |
65 | end |
|
65 | end | |
66 | end |
|
66 | end | |
67 | redirect_to :action => 'index' |
|
67 | redirect_to :action => 'index' | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_email |
|
70 | def test_email | |
71 | raise_delivery_errors = ActionMailer::Base.raise_delivery_errors |
|
71 | raise_delivery_errors = ActionMailer::Base.raise_delivery_errors | |
72 | # Force ActionMailer to raise delivery errors so we can catch it |
|
72 | # Force ActionMailer to raise delivery errors so we can catch it | |
73 | ActionMailer::Base.raise_delivery_errors = true |
|
73 | ActionMailer::Base.raise_delivery_errors = true | |
74 | begin |
|
74 | begin | |
75 | @test = Mailer.deliver_test(User.current) |
|
75 | @test = Mailer.deliver_test(User.current) | |
76 | flash[:notice] = l(:notice_email_sent, User.current.mail) |
|
76 | flash[:notice] = l(:notice_email_sent, User.current.mail) | |
77 | rescue Exception => e |
|
77 | rescue Exception => e | |
78 | flash[:error] = l(:notice_email_error, e.message) |
|
78 | flash[:error] = l(:notice_email_error, e.message) | |
79 | end |
|
79 | end | |
80 | ActionMailer::Base.raise_delivery_errors = raise_delivery_errors |
|
80 | ActionMailer::Base.raise_delivery_errors = raise_delivery_errors | |
81 | redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' |
|
81 | redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' | |
82 | end |
|
82 | end | |
83 |
|
83 | |||
84 | def info |
|
84 | def info | |
85 | @db_adapter_name = ActiveRecord::Base.connection.adapter_name |
|
85 | @db_adapter_name = ActiveRecord::Base.connection.adapter_name | |
86 | @flags = { |
|
86 | @flags = { | |
87 | :default_admin_changed => User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?, |
|
87 | :default_admin_changed => User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?, | |
88 | :file_repository_writable => File.writable?(Attachment.storage_path), |
|
88 | :file_repository_writable => File.writable?(Attachment.storage_path), | |
89 | :rmagick_available => Object.const_defined?(:Magick) |
|
89 | :rmagick_available => Object.const_defined?(:Magick) | |
90 | } |
|
90 | } | |
91 | end |
|
91 | end | |
92 | end |
|
92 | end |
@@ -1,17 +1,17 | |||||
1 | <h2><%= l(:label_plugins) %></h2> |
|
1 | <h2><%= l(:label_plugins) %></h2> | |
2 |
|
2 | |||
3 | <% if @plugins.any? %> |
|
3 | <% if @plugins.any? %> | |
4 | <table class="list"> |
|
4 | <table class="list"> | |
5 |
<% @plugins |
|
5 | <% @plugins.each do |plugin| %> | |
6 | <tr class="<%= cycle('odd', 'even') %>"> |
|
6 | <tr class="<%= cycle('odd', 'even') %>"> | |
7 |
<td><%=h |
|
7 | <td><%=h plugin.name %></td> | |
8 |
<td><%=h |
|
8 | <td><%=h plugin.description %></td> | |
9 |
<td><%=h |
|
9 | <td><%=h plugin.author %></td> | |
10 |
<td><%=h |
|
10 | <td><%=h plugin.version %></td> | |
11 |
<td><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin. |
|
11 | <td><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %></td> | |
12 | </tr> |
|
12 | </tr> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | </table> |
|
14 | </table> | |
15 | <% else %> |
|
15 | <% else %> | |
16 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
16 | <p class="nodata"><%= l(:label_no_data) %></p> | |
17 | <% end %> |
|
17 | <% end %> |
@@ -1,167 +1,176 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | module Redmine #:nodoc: |
|
18 | module Redmine #:nodoc: | |
19 |
|
19 | |||
20 | # Base class for Redmine plugins. |
|
20 | # Base class for Redmine plugins. | |
21 | # Plugins are registered using the <tt>register</tt> class method that acts as the public constructor. |
|
21 | # Plugins are registered using the <tt>register</tt> class method that acts as the public constructor. | |
22 | # |
|
22 | # | |
23 | # Redmine::Plugin.register :example do |
|
23 | # Redmine::Plugin.register :example do | |
24 | # name 'Example plugin' |
|
24 | # name 'Example plugin' | |
25 | # author 'John Smith' |
|
25 | # author 'John Smith' | |
26 | # description 'This is an example plugin for Redmine' |
|
26 | # description 'This is an example plugin for Redmine' | |
27 | # version '0.0.1' |
|
27 | # version '0.0.1' | |
28 | # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' |
|
28 | # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' | |
29 | # end |
|
29 | # end | |
30 | # |
|
30 | # | |
31 | # === Plugin attributes |
|
31 | # === Plugin attributes | |
32 | # |
|
32 | # | |
33 | # +settings+ is an optional attribute that let the plugin be configurable. |
|
33 | # +settings+ is an optional attribute that let the plugin be configurable. | |
34 | # It must be a hash with the following keys: |
|
34 | # It must be a hash with the following keys: | |
35 | # * <tt>:default</tt>: default value for the plugin settings |
|
35 | # * <tt>:default</tt>: default value for the plugin settings | |
36 | # * <tt>:partial</tt>: path of the configuration partial view, relative to the plugin <tt>app/views</tt> directory |
|
36 | # * <tt>:partial</tt>: path of the configuration partial view, relative to the plugin <tt>app/views</tt> directory | |
37 | # Example: |
|
37 | # Example: | |
38 | # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' |
|
38 | # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' | |
39 | # In this example, the settings partial will be found here in the plugin directory: <tt>app/views/settings/_settings.rhtml</tt>. |
|
39 | # In this example, the settings partial will be found here in the plugin directory: <tt>app/views/settings/_settings.rhtml</tt>. | |
40 | # |
|
40 | # | |
41 | # When rendered, the plugin settings value is available as the local variable +settings+ |
|
41 | # When rendered, the plugin settings value is available as the local variable +settings+ | |
42 | class Plugin |
|
42 | class Plugin | |
43 | @registered_plugins = {} |
|
43 | @registered_plugins = {} | |
44 | class << self |
|
44 | class << self | |
45 | attr_reader :registered_plugins |
|
45 | attr_reader :registered_plugins | |
46 | private :new |
|
46 | private :new | |
47 |
|
47 | |||
48 | def def_field(*names) |
|
48 | def def_field(*names) | |
49 | class_eval do |
|
49 | class_eval do | |
50 | names.each do |name| |
|
50 | names.each do |name| | |
51 | define_method(name) do |*args| |
|
51 | define_method(name) do |*args| | |
52 | args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args) |
|
52 | args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args) | |
53 | end |
|
53 | end | |
54 | end |
|
54 | end | |
55 | end |
|
55 | end | |
56 | end |
|
56 | end | |
57 | end |
|
57 | end | |
58 | def_field :name, :description, :author, :version, :settings |
|
58 | def_field :name, :description, :author, :version, :settings | |
|
59 | attr_reader :id | |||
59 |
|
60 | |||
60 | # Plugin constructor |
|
61 | # Plugin constructor | |
61 |
def self.register( |
|
62 | def self.register(id, &block) | |
62 | p = new |
|
63 | p = new(id) | |
63 | p.instance_eval(&block) |
|
64 | p.instance_eval(&block) | |
64 |
Plugin.registered_plugins[ |
|
65 | Plugin.registered_plugins[id] = p | |
|
66 | end | |||
|
67 | ||||
|
68 | def initialize(id) | |||
|
69 | @id = id.to_sym | |||
|
70 | end | |||
|
71 | ||||
|
72 | def <=>(plugin) | |||
|
73 | self.id.to_s <=> plugin.id.to_s | |||
65 | end |
|
74 | end | |
66 |
|
75 | |||
67 | # Adds an item to the given +menu+. |
|
76 | # Adds an item to the given +menu+. | |
68 | # The +id+ parameter (equals to the project id) is automatically added to the url. |
|
77 | # The +id+ parameter (equals to the project id) is automatically added to the url. | |
69 | # menu :project_menu, :plugin_example, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' |
|
78 | # menu :project_menu, :plugin_example, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' | |
70 | # |
|
79 | # | |
71 | # +name+ parameter can be: :top_menu, :account_menu, :application_menu or :project_menu |
|
80 | # +name+ parameter can be: :top_menu, :account_menu, :application_menu or :project_menu | |
72 | # |
|
81 | # | |
73 | def menu(menu, item, url, options={}) |
|
82 | def menu(menu, item, url, options={}) | |
74 | Redmine::MenuManager.map(menu).push(item, url, options) |
|
83 | Redmine::MenuManager.map(menu).push(item, url, options) | |
75 | end |
|
84 | end | |
76 | alias :add_menu_item :menu |
|
85 | alias :add_menu_item :menu | |
77 |
|
86 | |||
78 | # Removes +item+ from the given +menu+. |
|
87 | # Removes +item+ from the given +menu+. | |
79 | def delete_menu_item(menu, item) |
|
88 | def delete_menu_item(menu, item) | |
80 | Redmine::MenuManager.map(menu).delete(item) |
|
89 | Redmine::MenuManager.map(menu).delete(item) | |
81 | end |
|
90 | end | |
82 |
|
91 | |||
83 | # Defines a permission called +name+ for the given +actions+. |
|
92 | # Defines a permission called +name+ for the given +actions+. | |
84 | # |
|
93 | # | |
85 | # The +actions+ argument is a hash with controllers as keys and actions as values (a single value or an array): |
|
94 | # The +actions+ argument is a hash with controllers as keys and actions as values (a single value or an array): | |
86 | # permission :destroy_contacts, { :contacts => :destroy } |
|
95 | # permission :destroy_contacts, { :contacts => :destroy } | |
87 | # permission :view_contacts, { :contacts => [:index, :show] } |
|
96 | # permission :view_contacts, { :contacts => [:index, :show] } | |
88 | # |
|
97 | # | |
89 | # The +options+ argument can be used to make the permission public (implicitly given to any user) |
|
98 | # The +options+ argument can be used to make the permission public (implicitly given to any user) | |
90 | # or to restrict users the permission can be given to. |
|
99 | # or to restrict users the permission can be given to. | |
91 | # |
|
100 | # | |
92 | # Examples |
|
101 | # Examples | |
93 | # # A permission that is implicitly given to any user |
|
102 | # # A permission that is implicitly given to any user | |
94 | # # This permission won't appear on the Roles & Permissions setup screen |
|
103 | # # This permission won't appear on the Roles & Permissions setup screen | |
95 | # permission :say_hello, { :example => :say_hello }, :public => true |
|
104 | # permission :say_hello, { :example => :say_hello }, :public => true | |
96 | # |
|
105 | # | |
97 | # # A permission that can be given to any user |
|
106 | # # A permission that can be given to any user | |
98 | # permission :say_hello, { :example => :say_hello } |
|
107 | # permission :say_hello, { :example => :say_hello } | |
99 | # |
|
108 | # | |
100 | # # A permission that can be given to registered users only |
|
109 | # # A permission that can be given to registered users only | |
101 | # permission :say_hello, { :example => :say_hello }, :require => loggedin |
|
110 | # permission :say_hello, { :example => :say_hello }, :require => loggedin | |
102 | # |
|
111 | # | |
103 | # # A permission that can be given to project members only |
|
112 | # # A permission that can be given to project members only | |
104 | # permission :say_hello, { :example => :say_hello }, :require => member |
|
113 | # permission :say_hello, { :example => :say_hello }, :require => member | |
105 | def permission(name, actions, options = {}) |
|
114 | def permission(name, actions, options = {}) | |
106 | if @project_module |
|
115 | if @project_module | |
107 | Redmine::AccessControl.map {|map| map.project_module(@project_module) {|map|map.permission(name, actions, options)}} |
|
116 | Redmine::AccessControl.map {|map| map.project_module(@project_module) {|map|map.permission(name, actions, options)}} | |
108 | else |
|
117 | else | |
109 | Redmine::AccessControl.map {|map| map.permission(name, actions, options)} |
|
118 | Redmine::AccessControl.map {|map| map.permission(name, actions, options)} | |
110 | end |
|
119 | end | |
111 | end |
|
120 | end | |
112 |
|
121 | |||
113 | # Defines a project module, that can be enabled/disabled for each project. |
|
122 | # Defines a project module, that can be enabled/disabled for each project. | |
114 | # Permissions defined inside +block+ will be bind to the module. |
|
123 | # Permissions defined inside +block+ will be bind to the module. | |
115 | # |
|
124 | # | |
116 | # project_module :things do |
|
125 | # project_module :things do | |
117 | # permission :view_contacts, { :contacts => [:list, :show] }, :public => true |
|
126 | # permission :view_contacts, { :contacts => [:list, :show] }, :public => true | |
118 | # permission :destroy_contacts, { :contacts => :destroy } |
|
127 | # permission :destroy_contacts, { :contacts => :destroy } | |
119 | # end |
|
128 | # end | |
120 | def project_module(name, &block) |
|
129 | def project_module(name, &block) | |
121 | @project_module = name |
|
130 | @project_module = name | |
122 | self.instance_eval(&block) |
|
131 | self.instance_eval(&block) | |
123 | @project_module = nil |
|
132 | @project_module = nil | |
124 | end |
|
133 | end | |
125 |
|
134 | |||
126 | # Registers an activity provider. |
|
135 | # Registers an activity provider. | |
127 | # |
|
136 | # | |
128 | # Options: |
|
137 | # Options: | |
129 | # * <tt>:class_name</tt> - one or more model(s) that provide these events (inferred from event_type by default) |
|
138 | # * <tt>:class_name</tt> - one or more model(s) that provide these events (inferred from event_type by default) | |
130 | # * <tt>:default</tt> - setting this option to false will make the events not displayed by default |
|
139 | # * <tt>:default</tt> - setting this option to false will make the events not displayed by default | |
131 | # |
|
140 | # | |
132 | # A model can provide several activity event types. |
|
141 | # A model can provide several activity event types. | |
133 | # |
|
142 | # | |
134 | # Examples: |
|
143 | # Examples: | |
135 | # register :news |
|
144 | # register :news | |
136 | # register :scrums, :class_name => 'Meeting' |
|
145 | # register :scrums, :class_name => 'Meeting' | |
137 | # register :issues, :class_name => ['Issue', 'Journal'] |
|
146 | # register :issues, :class_name => ['Issue', 'Journal'] | |
138 | # |
|
147 | # | |
139 | # Retrieving events: |
|
148 | # Retrieving events: | |
140 | # Associated model(s) must implement the find_events class method. |
|
149 | # Associated model(s) must implement the find_events class method. | |
141 | # ActiveRecord models can use acts_as_activity_provider as a way to implement this class method. |
|
150 | # ActiveRecord models can use acts_as_activity_provider as a way to implement this class method. | |
142 | # |
|
151 | # | |
143 | # The following call should return all the scrum events visible by current user that occured in the 5 last days: |
|
152 | # The following call should return all the scrum events visible by current user that occured in the 5 last days: | |
144 | # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today) |
|
153 | # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today) | |
145 | # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only |
|
154 | # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only | |
146 | # |
|
155 | # | |
147 | # Note that :view_scrums permission is required to view these events in the activity view. |
|
156 | # Note that :view_scrums permission is required to view these events in the activity view. | |
148 | def activity_provider(*args) |
|
157 | def activity_provider(*args) | |
149 | Redmine::Activity.register(*args) |
|
158 | Redmine::Activity.register(*args) | |
150 | end |
|
159 | end | |
151 |
|
160 | |||
152 | # Registers a wiki formatter. |
|
161 | # Registers a wiki formatter. | |
153 | # |
|
162 | # | |
154 | # Parameters: |
|
163 | # Parameters: | |
155 | # * +name+ - human-readable name |
|
164 | # * +name+ - human-readable name | |
156 | # * +formatter+ - formatter class, which should have an instance method +to_html+ |
|
165 | # * +formatter+ - formatter class, which should have an instance method +to_html+ | |
157 | # * +helper+ - helper module, which will be included by wiki pages |
|
166 | # * +helper+ - helper module, which will be included by wiki pages | |
158 | def wiki_format_provider(name, formatter, helper) |
|
167 | def wiki_format_provider(name, formatter, helper) | |
159 | Redmine::WikiFormatting.register(name, formatter, helper) |
|
168 | Redmine::WikiFormatting.register(name, formatter, helper) | |
160 | end |
|
169 | end | |
161 |
|
170 | |||
162 | # Returns +true+ if the plugin can be configured. |
|
171 | # Returns +true+ if the plugin can be configured. | |
163 | def configurable? |
|
172 | def configurable? | |
164 | settings && settings.is_a?(Hash) && !settings[:partial].blank? |
|
173 | settings && settings.is_a?(Hash) && !settings[:partial].blank? | |
165 | end |
|
174 | end | |
166 | end |
|
175 | end | |
167 | end |
|
176 | end |
General Comments 0
You need to be logged in to leave comments.
Login now