@@ -1,84 +1,84 | |||
|
1 |
# |
|
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 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 | before_filter :require_admin |
|
21 | 21 | helper :sort |
|
22 | 22 | include SortHelper |
|
23 | 23 | |
|
24 | 24 | def index |
|
25 | 25 | @no_configuration_data = Redmine::DefaultData::Loader::no_data? |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | def projects |
|
29 | 29 | @status = params[:status] ? params[:status].to_i : 1 |
|
30 | 30 | c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) |
|
31 | 31 | unless params[:name].blank? |
|
32 | 32 | name = "%#{params[:name].strip.downcase}%" |
|
33 | 33 | c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] |
|
34 | 34 | end |
|
35 | 35 | @projects = Project.find :all, :order => 'lft', |
|
36 | 36 | :conditions => c.conditions |
|
37 | 37 | |
|
38 | 38 | render :action => "projects", :layout => false if request.xhr? |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | def plugins |
|
42 | 42 | @plugins = Redmine::Plugin.all |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | # Loads the default configuration |
|
46 | 46 | # (roles, trackers, statuses, workflow, enumerations) |
|
47 | 47 | def default_configuration |
|
48 | 48 | if request.post? |
|
49 | 49 | begin |
|
50 | 50 | Redmine::DefaultData::Loader::load(params[:lang]) |
|
51 | 51 | flash[:notice] = l(:notice_default_data_loaded) |
|
52 | 52 | rescue Exception => e |
|
53 | 53 | flash[:error] = l(:error_can_t_load_default_data, e.message) |
|
54 | 54 | end |
|
55 | 55 | end |
|
56 | 56 | redirect_to :action => 'index' |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | def test_email |
|
60 | 60 | raise_delivery_errors = ActionMailer::Base.raise_delivery_errors |
|
61 | 61 | # Force ActionMailer to raise delivery errors so we can catch it |
|
62 | 62 | ActionMailer::Base.raise_delivery_errors = true |
|
63 | 63 | begin |
|
64 | 64 | @test = Mailer.deliver_test(User.current) |
|
65 | 65 | flash[:notice] = l(:notice_email_sent, User.current.mail) |
|
66 | 66 | rescue Exception => e |
|
67 | 67 | flash[:error] = l(:notice_email_error, e.message) |
|
68 | 68 | end |
|
69 | 69 | ActionMailer::Base.raise_delivery_errors = raise_delivery_errors |
|
70 | 70 | redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' |
|
71 | 71 | end |
|
72 | 72 | |
|
73 | 73 | def info |
|
74 | 74 | @db_adapter_name = ActiveRecord::Base.connection.adapter_name |
|
75 | 75 | @checklist = [ |
|
76 | 76 | [:text_default_administrator_account_changed, |
|
77 | 77 | User.find(:first, |
|
78 | 78 | :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?], |
|
79 | 79 | [:text_file_repository_writable, File.writable?(Attachment.storage_path)], |
|
80 | 80 | [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], |
|
81 | 81 | [:text_rmagick_available, Object.const_defined?(:Magick)] |
|
82 | 82 | ] |
|
83 | 83 | end |
|
84 | 84 | end |
General Comments 0
You need to be logged in to leave comments.
Login now