2011-08-27 09:49:47 +04:00
|
|
|
# Redmine - project management software
|
2014-01-30 02:45:39 +04:00
|
|
|
# Copyright (C) 2006-2014 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
|
2013-02-17 14:14:35 +04:00
|
|
|
include SortHelper
|
2007-03-12 20:59:02 +03:00
|
|
|
|
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
|
2013-02-17 14:14:35 +04:00
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
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
|
2012-12-11 21:51:30 +04:00
|
|
|
redirect_to admin_path
|
2008-01-05 14:33:49 +03:00
|
|
|
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
|
2013-07-13 00:16:59 +04:00
|
|
|
flash[:error] = l(:notice_email_error, Redmine::CodesetUtil.replace_invalid_utf8(e.message))
|
2007-08-14 14:36:19 +04:00
|
|
|
end
|
|
|
|
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
|
2012-12-11 21:51:30 +04:00
|
|
|
redirect_to settings_path(: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)],
|
2013-11-16 00:11:00 +04:00
|
|
|
[:text_rmagick_available, Object.const_defined?(:Magick)],
|
|
|
|
[:text_convert_available, Redmine::Thumbnail.convert_available?]
|
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
|