comparison app/controllers/admin_controller.rb @ 1338:25603efa57b5

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:14 +0100
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
comparison
equal deleted inserted replaced
1209:1b1138f6f55e 1338:25603efa57b5
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang 2 # Copyright (C) 2006-2012 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.
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 menu_item :projects, :only => :projects
21 menu_item :plugins, :only => :plugins
22 menu_item :info, :only => :info
23
20 before_filter :require_admin 24 before_filter :require_admin
21 helper :sort 25 helper :sort
22 include SortHelper 26 include SortHelper
23 27
24 def index 28 def index
25 @no_configuration_data = Redmine::DefaultData::Loader::no_data? 29 @no_configuration_data = Redmine::DefaultData::Loader::no_data?
26 end 30 end
27 31
28 def projects 32 def projects
29 @status = params[:status] ? params[:status].to_i : 1 33 @status = params[:status] || 1
30 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) 34
31 unless params[:name].blank? 35 scope = Project.status(@status)
32 name = "%#{params[:name].strip.downcase}%" 36 scope = scope.like(params[:name]) if params[:name].present?
33 c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] 37
34 end 38 @projects = scope.all(:order => 'lft')
35 @projects = Project.find :all, :order => 'lft',
36 :conditions => c.conditions
37 39
38 render :action => "projects", :layout => false if request.xhr? 40 render :action => "projects", :layout => false if request.xhr?
39 end 41 end
40 42
41 def plugins 43 def plugins
59 def test_email 61 def test_email
60 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors 62 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
61 # Force ActionMailer to raise delivery errors so we can catch it 63 # Force ActionMailer to raise delivery errors so we can catch it
62 ActionMailer::Base.raise_delivery_errors = true 64 ActionMailer::Base.raise_delivery_errors = true
63 begin 65 begin
64 @test = Mailer.deliver_test(User.current) 66 @test = Mailer.test_email(User.current).deliver
65 flash[:notice] = l(:notice_email_sent, User.current.mail) 67 flash[:notice] = l(:notice_email_sent, User.current.mail)
66 rescue Exception => e 68 rescue Exception => e
67 flash[:error] = l(:notice_email_error, e.message) 69 flash[:error] = l(:notice_email_error, e.message)
68 end 70 end
69 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors 71 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
73 def info 75 def info
74 @db_adapter_name = ActiveRecord::Base.connection.adapter_name 76 @db_adapter_name = ActiveRecord::Base.connection.adapter_name
75 @checklist = [ 77 @checklist = [
76 [:text_default_administrator_account_changed, User.default_admin_account_changed?], 78 [:text_default_administrator_account_changed, User.default_admin_account_changed?],
77 [:text_file_repository_writable, File.writable?(Attachment.storage_path)], 79 [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
78 [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], 80 [:text_plugin_assets_writable, File.writable?(Redmine::Plugin.public_directory)],
79 [:text_rmagick_available, Object.const_defined?(:Magick)] 81 [:text_rmagick_available, Object.const_defined?(:Magick)]
80 ] 82 ]
81 end 83 end
82 end 84 end