Mercurial > hg > soundsoftware-site
comparison app/controllers/admin_controller.rb @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 513646585e45 |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
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 | |
21 before_filter :require_admin | 20 before_filter :require_admin |
22 | |
23 helper :sort | 21 helper :sort |
24 include SortHelper | 22 include SortHelper |
25 | 23 |
26 def index | 24 def index |
27 @no_configuration_data = Redmine::DefaultData::Loader::no_data? | 25 @no_configuration_data = Redmine::DefaultData::Loader::no_data? |
28 end | 26 end |
29 | 27 |
30 def projects | 28 def projects |
31 @status = params[:status] ? params[:status].to_i : 1 | 29 @status = params[:status] ? params[:status].to_i : 1 |
32 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) | 30 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) |
33 | |
34 unless params[:name].blank? | 31 unless params[:name].blank? |
35 name = "%#{params[:name].strip.downcase}%" | 32 name = "%#{params[:name].strip.downcase}%" |
36 c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] | 33 c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] |
37 end | 34 end |
38 | |
39 @projects = Project.find :all, :order => 'lft', | 35 @projects = Project.find :all, :order => 'lft', |
40 :conditions => c.conditions | 36 :conditions => c.conditions |
41 | 37 |
42 render :action => "projects", :layout => false if request.xhr? | 38 render :action => "projects", :layout => false if request.xhr? |
43 end | 39 end |
44 | 40 |
45 def plugins | 41 def plugins |
46 @plugins = Redmine::Plugin.all | 42 @plugins = Redmine::Plugin.all |
47 end | 43 end |
48 | 44 |
49 # Loads the default configuration | 45 # Loads the default configuration |
50 # (roles, trackers, statuses, workflow, enumerations) | 46 # (roles, trackers, statuses, workflow, enumerations) |
51 def default_configuration | 47 def default_configuration |
52 if request.post? | 48 if request.post? |
53 begin | 49 begin |
57 flash[:error] = l(:error_can_t_load_default_data, e.message) | 53 flash[:error] = l(:error_can_t_load_default_data, e.message) |
58 end | 54 end |
59 end | 55 end |
60 redirect_to :action => 'index' | 56 redirect_to :action => 'index' |
61 end | 57 end |
62 | 58 |
63 def test_email | 59 def test_email |
64 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors | 60 raise_delivery_errors = ActionMailer::Base.raise_delivery_errors |
65 # Force ActionMailer to raise delivery errors so we can catch it | 61 # Force ActionMailer to raise delivery errors so we can catch it |
66 ActionMailer::Base.raise_delivery_errors = true | 62 ActionMailer::Base.raise_delivery_errors = true |
67 begin | 63 begin |
71 flash[:error] = l(:notice_email_error, e.message) | 67 flash[:error] = l(:notice_email_error, e.message) |
72 end | 68 end |
73 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors | 69 ActionMailer::Base.raise_delivery_errors = raise_delivery_errors |
74 redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' | 70 redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' |
75 end | 71 end |
76 | 72 |
77 def info | 73 def info |
78 @db_adapter_name = ActiveRecord::Base.connection.adapter_name | 74 @db_adapter_name = ActiveRecord::Base.connection.adapter_name |
79 @checklist = [ | 75 @checklist = [ |
80 [:text_default_administrator_account_changed, User.find(:first, :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?], | 76 [:text_default_administrator_account_changed, |
77 User.find(:first, | |
78 :conditions => ["login=? and hashed_password=?", 'admin', User.hash_password('admin')]).nil?], | |
81 [:text_file_repository_writable, File.writable?(Attachment.storage_path)], | 79 [:text_file_repository_writable, File.writable?(Attachment.storage_path)], |
82 [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], | 80 [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], |
83 [:text_rmagick_available, Object.const_defined?(:Magick)] | 81 [:text_rmagick_available, Object.const_defined?(:Magick)] |
84 ] | 82 ] |
85 end | 83 end |
86 end | 84 end |