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