You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings_controller.rb 2.5 kB

13 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2013 Jean-Philippe Lang
  3. #
  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.
  8. #
  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.
  13. #
  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.
  17. class SettingsController < ApplicationController
  18. layout 'admin'
  19. menu_item :plugins, :only => :plugin
  20. helper :queries
  21. before_filter :require_admin
  22. def index
  23. edit
  24. render :action => 'edit'
  25. end
  26. def edit
  27. @notifiables = Redmine::Notifiable.all
  28. if request.post? && params[:settings] && params[:settings].is_a?(Hash)
  29. settings = (params[:settings] || {}).dup.symbolize_keys
  30. settings.each do |name, value|
  31. # remove blank values in array settings
  32. value.delete_if {|v| v.blank? } if value.is_a?(Array)
  33. Setting[name] = value
  34. end
  35. flash[:notice] = l(:notice_successful_update)
  36. redirect_to settings_path(:tab => params[:tab])
  37. else
  38. @options = {}
  39. user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]}
  40. @options[:user_format] = user_format.collect{|f| [User.current.name(f[0]), f[0].to_s]}
  41. @deliveries = ActionMailer::Base.perform_deliveries
  42. @guessed_host_and_path = request.host_with_port.dup
  43. @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
  44. Redmine::Themes.rescan
  45. end
  46. end
  47. def plugin
  48. @plugin = Redmine::Plugin.find(params[:id])
  49. unless @plugin.configurable?
  50. render_404
  51. return
  52. end
  53. if request.post?
  54. Setting.send "plugin_#{@plugin.id}=", params[:settings]
  55. flash[:notice] = l(:notice_successful_update)
  56. redirect_to plugin_settings_path(@plugin)
  57. else
  58. @partial = @plugin.settings[:partial]
  59. @settings = Setting.send "plugin_#{@plugin.id}"
  60. end
  61. rescue Redmine::PluginNotFound
  62. render_404
  63. end
  64. end

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...