admin_controller.rb
84 lines
| 2.8 KiB
| text/x-ruby
|
RubyLexer
|
r6545 | # Redmine - project management software | ||
|
r9453 | # Copyright (C) 2006-2012 Jean-Philippe Lang | ||
|
r330 | # | ||
# 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. | ||||
|
r6545 | # | ||
|
r330 | # 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. | ||||
|
r6545 | # | ||
|
r330 | # 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 | ||||
|
r3062 | layout 'admin' | ||
|
r8559 | menu_item :projects, :only => :projects | ||
menu_item :plugins, :only => :plugins | ||||
menu_item :info, :only => :info | ||||
|
r330 | before_filter :require_admin | ||
helper :sort | ||||
include SortHelper | ||||
|
r1027 | def index | ||
@no_configuration_data = Redmine::DefaultData::Loader::no_data? | ||||
|
r330 | end | ||
def projects | ||||
|
r7962 | @status = params[:status] || 1 | ||
scope = Project.status(@status) | ||||
scope = scope.like(params[:name]) if params[:name].present? | ||||
@projects = scope.all(:order => 'lft') | ||||
|
r330 | |||
render :action => "projects", :layout => false if request.xhr? | ||||
end | ||||
|
r5430 | |||
|
r2035 | def plugins | ||
|
r2037 | @plugins = Redmine::Plugin.all | ||
|
r2035 | end | ||
|
r5430 | |||
|
r1027 | # 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 | ||||
|
r5430 | |||
|
r629 | 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 | ||||
|
r9455 | @test = Mailer.test_email(User.current).deliver | ||
|
r663 | flash[:notice] = l(:notice_email_sent, User.current.mail) | ||
|
r629 | rescue Exception => e | ||
flash[:error] = l(:notice_email_error, e.message) | ||||
end | ||||
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors | ||||
|
r1033 | redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' | ||
|
r629 | end | ||
|
r5430 | |||
|
r330 | def info | ||
@db_adapter_name = ActiveRecord::Base.connection.adapter_name | ||||
|
r3086 | @checklist = [ | ||
|
r9245 | [:text_default_administrator_account_changed, User.default_admin_account_changed?], | ||
|
r3086 | [:text_file_repository_writable, File.writable?(Attachment.storage_path)], | ||
|
r8945 | [:text_plugin_assets_writable, File.writable?(Redmine::Plugin.public_directory)], | ||
|
r5430 | [:text_rmagick_available, Object.const_defined?(:Magick)] | ||
|
r3086 | ] | ||
|
r5430 | end | ||
|
r2 | end | ||