annotate app/controllers/admin_controller.rb @ 1465:ab8bd24eeb65 bug_635

Close obsolete branch bug_635
author Chris Cannam
date Fri, 19 Jul 2013 12:13:20 +0100
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
rev   line source
Chris@909 1 # Redmine - project management software
Chris@1115 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@0 18 class AdminController < ApplicationController
Chris@0 19 layout 'admin'
Chris@1115 20 menu_item :projects, :only => :projects
Chris@1115 21 menu_item :plugins, :only => :plugins
Chris@1115 22 menu_item :info, :only => :info
Chris@1115 23
Chris@0 24 before_filter :require_admin
Chris@0 25 helper :sort
Chris@0 26 include SortHelper
Chris@0 27
Chris@0 28 def index
Chris@0 29 @no_configuration_data = Redmine::DefaultData::Loader::no_data?
Chris@0 30 end
Chris@0 31
Chris@0 32 def projects
Chris@1115 33 @status = params[:status] || 1
Chris@1115 34
Chris@1115 35 scope = Project.status(@status)
Chris@1115 36 scope = scope.like(params[:name]) if params[:name].present?
Chris@1115 37
Chris@1115 38 @projects = scope.all(:order => 'lft')
Chris@0 39
Chris@0 40 render :action => "projects", :layout => false if request.xhr?
Chris@0 41 end
Chris@441 42
Chris@0 43 def plugins
Chris@0 44 @plugins = Redmine::Plugin.all
Chris@0 45 end
Chris@441 46
Chris@0 47 # Loads the default configuration
Chris@0 48 # (roles, trackers, statuses, workflow, enumerations)
Chris@0 49 def default_configuration
Chris@0 50 if request.post?
Chris@0 51 begin
Chris@0 52 Redmine::DefaultData::Loader::load(params[:lang])
Chris@0 53 flash[:notice] = l(:notice_default_data_loaded)
Chris@0 54 rescue Exception => e
Chris@0 55 flash[:error] = l(:error_can_t_load_default_data, e.message)
Chris@0 56 end
Chris@0 57 end
Chris@0 58 redirect_to :action => 'index'
Chris@0 59 end
Chris@441 60
Chris@0 61 def test_email
Chris@0 62 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
Chris@0 63 # Force ActionMailer to raise delivery errors so we can catch it
Chris@0 64 ActionMailer::Base.raise_delivery_errors = true
Chris@0 65 begin
Chris@1115 66 @test = Mailer.test_email(User.current).deliver
Chris@0 67 flash[:notice] = l(:notice_email_sent, User.current.mail)
Chris@0 68 rescue Exception => e
Chris@0 69 flash[:error] = l(:notice_email_error, e.message)
Chris@0 70 end
Chris@0 71 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
Chris@0 72 redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications'
Chris@0 73 end
Chris@441 74
Chris@0 75 def info
Chris@0 76 @db_adapter_name = ActiveRecord::Base.connection.adapter_name
Chris@0 77 @checklist = [
Chris@929 78 [:text_default_administrator_account_changed, User.default_admin_account_changed?],
Chris@0 79 [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
Chris@1115 80 [:text_plugin_assets_writable, File.writable?(Redmine::Plugin.public_directory)],
Chris@441 81 [:text_rmagick_available, Object.const_defined?(:Magick)]
Chris@0 82 ]
Chris@441 83 end
Chris@0 84 end