Mercurial > hg > soundsoftware-site
comparison app/controllers/.svn/text-base/settings_controller.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 8661b858af72 |
children |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
1 # redMine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2007 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 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. |
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 SettingsController < ApplicationController | 18 class SettingsController < ApplicationController |
19 layout 'admin' | 19 layout 'admin' |
20 | 20 |
21 before_filter :require_admin | 21 before_filter :require_admin |
22 | 22 |
23 def index | 23 def index |
24 edit | 24 edit |
25 render :action => 'edit' | 25 render :action => 'edit' |
34 value.delete_if {|v| v.blank? } if value.is_a?(Array) | 34 value.delete_if {|v| v.blank? } if value.is_a?(Array) |
35 Setting[name] = value | 35 Setting[name] = value |
36 end | 36 end |
37 flash[:notice] = l(:notice_successful_update) | 37 flash[:notice] = l(:notice_successful_update) |
38 redirect_to :action => 'edit', :tab => params[:tab] | 38 redirect_to :action => 'edit', :tab => params[:tab] |
39 return | 39 else |
40 @options = {} | |
41 @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } | |
42 @deliveries = ActionMailer::Base.perform_deliveries | |
43 | |
44 @guessed_host_and_path = request.host_with_port.dup | |
45 @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank? | |
46 | |
47 Redmine::Themes.rescan | |
40 end | 48 end |
41 @options = {} | |
42 @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } | |
43 @deliveries = ActionMailer::Base.perform_deliveries | |
44 | |
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? | |
47 | |
48 Redmine::Themes.rescan | |
49 end | 49 end |
50 | 50 |
51 def plugin | 51 def plugin |
52 @plugin = Redmine::Plugin.find(params[:id]) | 52 @plugin = Redmine::Plugin.find(params[:id]) |
53 if request.post? | 53 if request.post? |
54 Setting["plugin_#{@plugin.id}"] = params[:settings] | 54 Setting["plugin_#{@plugin.id}"] = params[:settings] |
55 flash[:notice] = l(:notice_successful_update) | 55 flash[:notice] = l(:notice_successful_update) |
56 redirect_to :action => 'plugin', :id => @plugin.id | 56 redirect_to :action => 'plugin', :id => @plugin.id |
57 else | |
58 @partial = @plugin.settings[:partial] | |
59 @settings = Setting["plugin_#{@plugin.id}"] | |
57 end | 60 end |
58 @partial = @plugin.settings[:partial] | |
59 @settings = Setting["plugin_#{@plugin.id}"] | |
60 rescue Redmine::PluginNotFound | 61 rescue Redmine::PluginNotFound |
61 render_404 | 62 render_404 |
62 end | 63 end |
63 end | 64 end |