1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 class SettingsController < ApplicationController
21 before_filter :require_admin
25 render :action => 'edit'
29 @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted wiki_content_added wiki_content_updated)
30 if request.post? && params[:settings] && params[:settings].is_a?(Hash)
31 settings = (params[:settings] || {}).dup.symbolize_keys
32 settings.each do |name, value|
33 # remove blank values in array settings
34 value.delete_if {|v| v.blank? } if value.is_a?(Array)
37 flash[:notice] = l(:notice_successful_update)
38 redirect_to :action => 'edit', :tab => params[:tab]
42 @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
43 @deliveries = ActionMailer::Base.perform_deliveries
45 @guessed_host_and_path = request.host_with_port.dup
46 @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
50 @plugin = Redmine::Plugin.find(params[:id])
52 Setting["plugin_#{@plugin.id}"] = params[:settings]
53 flash[:notice] = l(:notice_successful_update)
54 redirect_to :action => 'plugin', :id => @plugin.id
56 @partial = @plugin.settings[:partial]
57 @settings = Setting["plugin_#{@plugin.id}"]
58 rescue Redmine::PluginNotFound