Property changes on: . ___________________________________________________________________ Name: svn:ignore + .generators .rakeTasks Index: app/controllers/admin_controller.rb =================================================================== --- app/controllers/admin_controller.rb (revision 391) +++ app/controllers/admin_controller.rb (working copy) @@ -56,5 +56,6 @@ @flags[:default_admin_changed] = User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil? @flags[:file_repository_writable] = File.writable?(Attachment.storage_path) @flags[:textile_available] = ActionView::Helpers::TextHelper.method_defined? "textilize" + @flags[:default_email_changed] = Setting.mail_configured? end end Index: app/controllers/email_settings_controller.rb =================================================================== --- app/controllers/email_settings_controller.rb (revision 0) +++ app/controllers/email_settings_controller.rb (revision 0) @@ -0,0 +1,35 @@ +# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class EmailSettingsController < ApplicationController + layout 'base' + before_filter :require_admin + + def index + edit + render :action => 'edit' + end + + def edit + if request.post? and params[:settings] and params[:settings].is_a? Hash + params[:settings].each { |name, value| Setting[name] = value } + Setting[:mail_configured] = 1 + EmailSettingsHelper.setup_email + redirect_to :action => 'edit' and return + end + end +end Index: app/helpers/email_settings_helper.rb =================================================================== --- app/helpers/email_settings_helper.rb (revision 0) +++ app/helpers/email_settings_helper.rb (revision 0) @@ -0,0 +1,17 @@ +module EmailSettingsHelper + def EmailSettingsHelper.setup_email + case Setting.mailer_type + when "smtp" + ActionMailer::Base.smtp_settings = {:address => Setting.smtp_address, :port => Setting.smtp_port, :domain => Setting.smtp_domain, :user_name => Setting.smtp_username, :password => Setting.smtp_password, :authentication => Setting.smtp_authentication_type} + ActionMailer::Base.delivery_method = "smtp" + ActionMailer::Base.perform_deliveries = true + when "sendmail" + ActionMailer::Base.sendmail_settings = {:location => Setting.sendmail_location, :arguments => Setting.sendmail_arguments} + ActionMailer::Base.delivery_method = "sendmail" + ActionMailer::Base.perform_deliveries = true + else + ActionMailer::Base.delivery_method = "test" + ActionMailer::Base.perform_deliveries = false + end + end +end Index: app/views/admin/_menu.rhtml =================================================================== --- app/views/admin/_menu.rhtml (revision 391) +++ app/views/admin/_menu.rhtml (working copy) @@ -8,6 +8,7 @@ <%= link_to l(:field_mail_notification), {:controller => 'admin', :action => 'mail_options' }, :class => "menuItem" %> <%= link_to l(:label_authentication), {:controller => 'auth_sources' }, :class => "menuItem" %> <%= link_to l(:label_settings), {:controller => 'settings' }, :class => "menuItem" %> + <%= link_to l(:label_email_settings), {:controller => 'email_settings' }, :class => "menuItem" %> <%= link_to l(:label_information_plural), {:controller => 'admin', :action => 'info' }, :class => "menuItem" %>