2019-03-16 10:37:35 +01:00
|
|
|
# frozen_string_literal: true
|
2019-03-15 02:32:57 +01:00
|
|
|
|
2011-08-27 07:49:47 +02:00
|
|
|
# Redmine - project management software
|
2024-02-26 23:55:54 +01:00
|
|
|
# Copyright (C) 2006- Jean-Philippe Lang
|
2007-03-12 18:59:02 +01: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 07:49:47 +02:00
|
|
|
#
|
2007-03-12 18:59:02 +01: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 07:49:47 +02:00
|
|
|
#
|
2007-03-12 18:59:02 +01: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 19:21:02 +01:00
|
|
|
layout 'admin'
|
2016-11-19 11:30:02 +01:00
|
|
|
self.main_menu = false
|
2012-01-20 21:02:04 +01:00
|
|
|
menu_item :projects, :only => :projects
|
|
|
|
menu_item :plugins, :only => :plugins
|
|
|
|
menu_item :info, :only => :info
|
|
|
|
|
2016-07-14 09:27:31 +02:00
|
|
|
before_action :require_admin
|
2007-03-12 18:59:02 +01:00
|
|
|
|
2022-04-01 17:08:52 +02:00
|
|
|
helper :queries
|
|
|
|
include QueriesHelper
|
|
|
|
helper :projects_queries
|
|
|
|
helper :projects
|
|
|
|
|
2008-01-05 12:33:49 +01:00
|
|
|
def index
|
|
|
|
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
|
2007-03-12 18:59:02 +01:00
|
|
|
end
|
2013-02-17 11:14:35 +01:00
|
|
|
|
2007-03-12 18:59:02 +01:00
|
|
|
def projects
|
2022-04-01 17:08:52 +02:00
|
|
|
retrieve_query(ProjectQuery, false, :defaults => @default_columns_names)
|
|
|
|
@query.admin_projects = 1
|
2016-08-30 22:10:56 +02:00
|
|
|
|
2024-05-03 15:14:18 +02:00
|
|
|
@entry_count = @query.result_count
|
2022-04-01 17:08:52 +02:00
|
|
|
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
|
2024-05-03 15:14:18 +02:00
|
|
|
@projects = @query.results_scope(:limit => @entry_pages.per_page, :offset => @entry_pages.offset).to_a
|
2007-03-12 18:59:02 +01:00
|
|
|
|
|
|
|
render :action => "projects", :layout => false if request.xhr?
|
|
|
|
end
|
2011-04-26 01:21:34 +02:00
|
|
|
|
2008-11-16 12:58:41 +01:00
|
|
|
def plugins
|
2008-11-16 16:38:37 +01:00
|
|
|
@plugins = Redmine::Plugin.all
|
2008-11-16 12:58:41 +01:00
|
|
|
end
|
2011-04-26 01:21:34 +02:00
|
|
|
|
2008-01-05 12:33:49 +01: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)
|
2019-05-25 08:50:25 +02:00
|
|
|
rescue => e
|
2015-02-17 18:47:36 +01:00
|
|
|
flash[:error] = l(:error_can_t_load_default_data, ERB::Util.h(e.message))
|
2008-01-05 12:33:49 +01:00
|
|
|
end
|
|
|
|
end
|
2012-12-11 18:51:30 +01:00
|
|
|
redirect_to admin_path
|
2008-01-05 12:33:49 +01:00
|
|
|
end
|
2011-04-26 01:21:34 +02:00
|
|
|
|
2007-08-14 12:36:19 +02:00
|
|
|
def test_email
|
|
|
|
begin
|
2018-10-10 19:13:09 +02:00
|
|
|
Mailer.deliver_test_email(User.current)
|
2015-02-17 18:47:36 +01:00
|
|
|
flash[:notice] = l(:notice_email_sent, ERB::Util.h(User.current.mail))
|
2019-05-25 08:50:25 +02:00
|
|
|
rescue => e
|
2015-02-17 18:47:36 +01:00
|
|
|
flash[:error] = l(:notice_email_error, ERB::Util.h(Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup)))
|
2007-08-14 12:36:19 +02:00
|
|
|
end
|
2012-12-11 18:51:30 +01:00
|
|
|
redirect_to settings_path(:tab => 'notifications')
|
2007-08-14 12:36:19 +02:00
|
|
|
end
|
2011-04-26 01:21:34 +02:00
|
|
|
|
2007-03-12 18:59:02 +01:00
|
|
|
def info
|
2009-12-19 21:33:24 +01:00
|
|
|
@checklist = [
|
2012-04-09 17:53:48 +02:00
|
|
|
[:text_default_administrator_account_changed, User.default_admin_account_changed?],
|
2009-12-19 21:33:24 +01:00
|
|
|
[:text_file_repository_writable, File.writable?(Attachment.storage_path)],
|
2021-07-30 05:51:19 +02:00
|
|
|
[:text_all_migrations_have_been_run, !ActiveRecord::Base.connection.migration_context.needs_migration?],
|
2019-08-14 04:40:56 +02:00
|
|
|
[:text_minimagick_available, Object.const_defined?(:MiniMagick)],
|
2019-05-12 05:55:56 +02:00
|
|
|
[:text_convert_available, Redmine::Thumbnail.convert_available?],
|
|
|
|
[:text_gs_available, Redmine::Thumbnail.gs_available?]
|
2009-12-19 21:33:24 +01:00
|
|
|
]
|
2023-10-30 10:11:34 +01:00
|
|
|
@checklist << [:text_default_active_job_queue_changed, Rails.application.config.active_job.queue_adapter != :async] if Rails.env.production?
|
2011-04-26 01:21:34 +02:00
|
|
|
end
|
2006-06-28 20:11:03 +02:00
|
|
|
end
|