2011-08-27 09:49:47 +04:00
|
|
|
# Redmine - project management software
|
2012-05-05 16:56:53 +04:00
|
|
|
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
2007-03-12 20:59:02 +03:00
|
|
|
#
|
|
|
|
# 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.
|
2011-08-27 09:49:47 +04:00
|
|
|
#
|
2007-03-12 20:59:02 +03:00
|
|
|
# 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.
|
2011-08-27 09:49:47 +04:00
|
|
|
#
|
2007-03-12 20:59:02 +03:00
|
|
|
# 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 AdminController < ApplicationController
|
2009-12-17 21:21:02 +03:00
|
|
|
layout 'admin'
|
2012-01-21 00:02:04 +04:00
|
|
|
menu_item :projects, :only => :projects
|
|
|
|
menu_item :plugins, :only => :plugins
|
|
|
|
menu_item :info, :only => :info
|
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
before_filter :require_admin
|
|
|
|
helper :sort
|
|
|
|
include SortHelper
|
|
|
|
|
2008-01-05 14:33:49 +03:00
|
|
|
def index
|
|
|
|
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
|
2007-03-12 20:59:02 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def projects
|
2011-12-05 02:31:02 +04:00
|
|
|
@status = params[:status] || 1
|
|
|
|
|
2012-12-04 01:30:10 +04:00
|
|
|
scope = Project.status(@status).order('lft')
|
2011-12-05 02:31:02 +04:00
|
|
|
scope = scope.like(params[:name]) if params[:name].present?
|
2012-12-04 01:30:10 +04:00
|
|
|
@projects = scope.all
|
2007-03-12 20:59:02 +03:00
|
|
|
|
|
|
|
render :action => "projects", :layout => false if request.xhr?
|
|
|
|
end
|
2011-04-26 03:21:34 +04:00
|
|
|
|
2008-11-16 14:58:41 +03:00
|
|
|
def plugins
|
2008-11-16 18:38:37 +03:00
|
|
|
@plugins = Redmine::Plugin.all
|
2008-11-16 14:58:41 +03:00
|
|
|
end
|
2011-04-26 03:21:34 +04:00
|
|
|
|
2008-01-05 14:33:49 +03:00
|
|
|
# Loads the default configuration
|
|
|
|
# (roles, trackers, statuses, workflow, enumerations)
|
|
|
|
def default_configuration
|
|
|
|
if request.post?
|
|
|
|
begin
|
|
|
|
Redmine::DefaultData::Loader::load(params[:lang])
|
|
|
|
flash[:notice] = l(:notice_default_data_loaded)
|
|
|
|
rescue Exception => e
|
|
|
|
flash[:error] = l(:error_can_t_load_default_data, e.message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
redirect_to :action => 'index'
|
|
|
|
end
|
2011-04-26 03:21:34 +04:00
|
|
|
|
2007-08-14 14:36:19 +04:00
|
|
|
def test_email
|
|
|
|
raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
|
|
|
|
# Force ActionMailer to raise delivery errors so we can catch it
|
|
|
|
ActionMailer::Base.raise_delivery_errors = true
|
|
|
|
begin
|
2012-05-05 17:07:12 +04:00
|
|
|
@test = Mailer.test_email(User.current).deliver
|
2007-08-29 20:52:35 +04:00
|
|
|
flash[:notice] = l(:notice_email_sent, User.current.mail)
|
2007-08-14 14:36:19 +04:00
|
|
|
rescue Exception => e
|
|
|
|
flash[:error] = l(:notice_email_error, e.message)
|
|
|
|
end
|
|
|
|
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
|
2008-01-06 23:24:26 +03:00
|
|
|
redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications'
|
2007-08-14 14:36:19 +04:00
|
|
|
end
|
2011-04-26 03:21:34 +04:00
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
def info
|
|
|
|
@db_adapter_name = ActiveRecord::Base.connection.adapter_name
|
2009-12-19 23:33:24 +03:00
|
|
|
@checklist = [
|
2012-04-09 19:53:48 +04:00
|
|
|
[:text_default_administrator_account_changed, User.default_admin_account_changed?],
|
2009-12-19 23:33:24 +03:00
|
|
|
[:text_file_repository_writable, File.writable?(Attachment.storage_path)],
|
2012-03-04 14:29:47 +04:00
|
|
|
[:text_plugin_assets_writable, File.writable?(Redmine::Plugin.public_directory)],
|
2011-04-26 03:21:34 +04:00
|
|
|
[:text_rmagick_available, Object.const_defined?(:Magick)]
|
2009-12-19 23:33:24 +03:00
|
|
|
]
|
2011-04-26 03:21:34 +04:00
|
|
|
end
|
2006-06-28 22:11:03 +04:00
|
|
|
end
|