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