##// END OF EJS Templates
Admin info cleanup....
Jean-Philippe Lang -
r3086:4398386c48bb
parent child
Show More
@@ -1,86 +1,86
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
2 # Copyright (C) 2006 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class AdminController < ApplicationController
18 class AdminController < ApplicationController
19 layout 'admin'
19 layout 'admin'
20
20
21 before_filter :require_admin
21 before_filter :require_admin
22
22
23 helper :sort
23 helper :sort
24 include SortHelper
24 include SortHelper
25
25
26 def index
26 def index
27 @no_configuration_data = Redmine::DefaultData::Loader::no_data?
27 @no_configuration_data = Redmine::DefaultData::Loader::no_data?
28 end
28 end
29
29
30 def projects
30 def projects
31 @status = params[:status] ? params[:status].to_i : 1
31 @status = params[:status] ? params[:status].to_i : 1
32 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
32 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
33
33
34 unless params[:name].blank?
34 unless params[:name].blank?
35 name = "%#{params[:name].strip.downcase}%"
35 name = "%#{params[:name].strip.downcase}%"
36 c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name]
36 c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name]
37 end
37 end
38
38
39 @projects = Project.find :all, :order => 'lft',
39 @projects = Project.find :all, :order => 'lft',
40 :conditions => c.conditions
40 :conditions => c.conditions
41
41
42 render :action => "projects", :layout => false if request.xhr?
42 render :action => "projects", :layout => false if request.xhr?
43 end
43 end
44
44
45 def plugins
45 def plugins
46 @plugins = Redmine::Plugin.all
46 @plugins = Redmine::Plugin.all
47 end
47 end
48
48
49 # Loads the default configuration
49 # Loads the default configuration
50 # (roles, trackers, statuses, workflow, enumerations)
50 # (roles, trackers, statuses, workflow, enumerations)
51 def default_configuration
51 def default_configuration
52 if request.post?
52 if request.post?
53 begin
53 begin
54 Redmine::DefaultData::Loader::load(params[:lang])
54 Redmine::DefaultData::Loader::load(params[:lang])
55 flash[:notice] = l(:notice_default_data_loaded)
55 flash[:notice] = l(:notice_default_data_loaded)
56 rescue Exception => e
56 rescue Exception => e
57 flash[:error] = l(:error_can_t_load_default_data, e.message)
57 flash[:error] = l(:error_can_t_load_default_data, e.message)
58 end
58 end
59 end
59 end
60 redirect_to :action => 'index'
60 redirect_to :action => 'index'
61 end
61 end
62
62
63 def test_email
63 def test_email
64 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
64 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
65 # Force ActionMailer to raise delivery errors so we can catch it
65 # Force ActionMailer to raise delivery errors so we can catch it
66 ActionMailer::Base.raise_delivery_errors = true
66 ActionMailer::Base.raise_delivery_errors = true
67 begin
67 begin
68 @test = Mailer.deliver_test(User.current)
68 @test = Mailer.deliver_test(User.current)
69 flash[:notice] = l(:notice_email_sent, User.current.mail)
69 flash[:notice] = l(:notice_email_sent, User.current.mail)
70 rescue Exception => e
70 rescue Exception => e
71 flash[:error] = l(:notice_email_error, e.message)
71 flash[:error] = l(:notice_email_error, e.message)
72 end
72 end
73 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
73 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
74 redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications'
74 redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications'
75 end
75 end
76
76
77 def info
77 def info
78 @db_adapter_name = ActiveRecord::Base.connection.adapter_name
78 @db_adapter_name = ActiveRecord::Base.connection.adapter_name
79 @flags = {
79 @checklist = [
80 :default_admin_changed => User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?,
80 [:text_default_administrator_account_changed, User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?],
81 :file_repository_writable => File.writable?(Attachment.storage_path),
81 [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
82 :plugin_assets_writable => File.writable?(Engines.public_directory),
82 [:text_plugin_assets_writable, File.writable?(Engines.public_directory)],
83 :rmagick_available => Object.const_defined?(:Magick)
83 [:text_rmagick_available, Object.const_defined?(:Magick)]
84 }
84 ]
85 end
85 end
86 end
86 end
@@ -1,12 +1,14
1 <h2><%=l(:label_information_plural)%></h2>
1 <h2><%=l(:label_information_plural)%></h2>
2
2
3 <p><strong><%= Redmine::Info.versioned_name %></strong> (<%= @db_adapter_name %>)</p>
3 <p><strong><%= Redmine::Info.versioned_name %></strong> (<%= @db_adapter_name %>)</p>
4
4
5 <table class="list">
5 <table class="list">
6 <tr class="odd"><td><%= l(:text_default_administrator_account_changed) %></td><td><%= image_tag (@flags[:default_admin_changed] ? 'true.png' : 'false.png'), :style => "vertical-align:bottom;" %></td></tr>
6 <% @checklist.each do |label, result| %>
7 <tr class="even"><td><%= l(:text_file_repository_writable) %> (<%= Attachment.storage_path %>)</td><td><%= image_tag (@flags[:file_repository_writable] ? 'true.png' : 'false.png'), :style => "vertical-align:bottom;" %></td></tr>
7 <tr class="<%= cycle 'odd', 'even' %>">
8 <tr class="odd"><td><%= l(:text_plugin_assets_writable) %> (<%= Engines.public_directory %>)</td><td><%= image_tag (@flags[:plugin_assets_writable] ? 'true.png' : 'false.png'), :style => "vertical-align:bottom;" %></td></tr>
8 <td><%= l(label) %></td>
9 <tr class="even"><td><%= l(:text_rmagick_available) %></td><td><%= image_tag (@flags[:rmagick_available] ? 'true.png' : 'false.png'), :style => "vertical-align:bottom;" %></td></tr>
9 <td width="30px"><%= image_tag((result ? 'true.png' : 'exclamation.png'), :style => "vertical-align:bottom;") %></td>
10 </tr>
11 <% end %>
10 </table>
12 </table>
11
13
12 <% html_title(l(:label_information_plural)) -%>
14 <% html_title(l(:label_information_plural)) -%>
General Comments 0
You need to be logged in to leave comments. Login now