| 
									
										
										
										
											2011-08-27 05:49:47 +00:00
										 |  |  | # Redmine - project management software | 
					
						
							| 
									
										
										
										
											2014-01-29 22:45:39 +00:00
										 |  |  | # Copyright (C) 2006-2014  Jean-Philippe Lang | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | # | 
					
						
							|  |  |  | # This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  | # modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  | # as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  | # of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2011-08-27 05:49:47 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | # This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | # GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											2011-08-27 05:49:47 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | # You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | # along with this program; if not, write to the Free Software | 
					
						
							|  |  |  | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AdminController < ApplicationController | 
					
						
							| 
									
										
										
										
											2009-12-17 18:21:02 +00:00
										 |  |  |   layout 'admin' | 
					
						
							| 
									
										
										
										
											2012-01-20 20:02:04 +00:00
										 |  |  |   menu_item :projects, :only => :projects | 
					
						
							|  |  |  |   menu_item :plugins, :only => :plugins | 
					
						
							|  |  |  |   menu_item :info, :only => :info | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |   before_filter :require_admin | 
					
						
							|  |  |  |   helper :sort | 
					
						
							| 
									
										
										
										
											2013-02-17 10:14:35 +00:00
										 |  |  |   include SortHelper | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-05 11:33:49 +00:00
										 |  |  |   def index | 
					
						
							|  |  |  |     @no_configuration_data = Redmine::DefaultData::Loader::no_data? | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-02-17 10:14:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |   def projects | 
					
						
							| 
									
										
										
										
											2011-12-04 22:31:02 +00:00
										 |  |  |     @status = params[:status] || 1
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-03 21:30:10 +00:00
										 |  |  |     scope = Project.status(@status).order('lft') | 
					
						
							| 
									
										
										
										
											2011-12-04 22:31:02 +00:00
										 |  |  |     scope = scope.like(params[:name]) if params[:name].present? | 
					
						
							| 
									
										
										
										
											2012-12-03 21:30:10 +00:00
										 |  |  |     @projects = scope.all | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     render :action => "projects", :layout => false if request.xhr? | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-04-25 23:21:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-16 11:58:41 +00:00
										 |  |  |   def plugins | 
					
						
							| 
									
										
										
										
											2008-11-16 15:38:37 +00:00
										 |  |  |     @plugins = Redmine::Plugin.all | 
					
						
							| 
									
										
										
										
											2008-11-16 11:58:41 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-04-25 23:21:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-05 11:33:49 +00:00
										 |  |  |   # Loads the default configuration | 
					
						
							|  |  |  |   # (roles, trackers, statuses, workflow, enumerations) | 
					
						
							|  |  |  |   def default_configuration | 
					
						
							|  |  |  |     if request.post? | 
					
						
							|  |  |  |       begin | 
					
						
							|  |  |  |         Redmine::DefaultData::Loader::load(params[:lang]) | 
					
						
							|  |  |  |         flash[:notice] = l(:notice_default_data_loaded) | 
					
						
							|  |  |  |       rescue Exception => e | 
					
						
							|  |  |  |         flash[:error] = l(:error_can_t_load_default_data, e.message) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-12-11 17:51:30 +00:00
										 |  |  |     redirect_to admin_path | 
					
						
							| 
									
										
										
										
											2008-01-05 11:33:49 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-04-25 23:21:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-14 10:36:19 +00:00
										 |  |  |   def test_email | 
					
						
							|  |  |  |     raise_delivery_errors = ActionMailer::Base.raise_delivery_errors | 
					
						
							|  |  |  |     # Force ActionMailer to raise delivery errors so we can catch it | 
					
						
							|  |  |  |     ActionMailer::Base.raise_delivery_errors = true | 
					
						
							|  |  |  |     begin | 
					
						
							| 
									
										
										
										
											2012-05-05 13:07:12 +00:00
										 |  |  |       @test = Mailer.test_email(User.current).deliver | 
					
						
							| 
									
										
										
										
											2007-08-29 16:52:35 +00:00
										 |  |  |       flash[:notice] = l(:notice_email_sent, User.current.mail) | 
					
						
							| 
									
										
										
										
											2007-08-14 10:36:19 +00:00
										 |  |  |     rescue Exception => e | 
					
						
							| 
									
										
										
										
											2013-07-12 20:16:59 +00:00
										 |  |  |       flash[:error] = l(:notice_email_error, Redmine::CodesetUtil.replace_invalid_utf8(e.message)) | 
					
						
							| 
									
										
										
										
											2007-08-14 10:36:19 +00:00
										 |  |  |     end | 
					
						
							|  |  |  |     ActionMailer::Base.raise_delivery_errors = raise_delivery_errors | 
					
						
							| 
									
										
										
										
											2012-12-11 17:51:30 +00:00
										 |  |  |     redirect_to settings_path(:tab => 'notifications') | 
					
						
							| 
									
										
										
										
											2007-08-14 10:36:19 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2011-04-25 23:21:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |   def info | 
					
						
							|  |  |  |     @db_adapter_name = ActiveRecord::Base.connection.adapter_name | 
					
						
							| 
									
										
										
										
											2009-12-19 20:33:24 +00:00
										 |  |  |     @checklist = [ | 
					
						
							| 
									
										
										
										
											2012-04-09 15:53:48 +00:00
										 |  |  |       [:text_default_administrator_account_changed, User.default_admin_account_changed?], | 
					
						
							| 
									
										
										
										
											2009-12-19 20:33:24 +00:00
										 |  |  |       [:text_file_repository_writable, File.writable?(Attachment.storage_path)], | 
					
						
							| 
									
										
										
										
											2012-03-04 10:29:47 +00:00
										 |  |  |       [:text_plugin_assets_writable,   File.writable?(Redmine::Plugin.public_directory)], | 
					
						
							| 
									
										
										
										
											2013-11-15 20:11:00 +00:00
										 |  |  |       [:text_rmagick_available,        Object.const_defined?(:Magick)], | 
					
						
							|  |  |  |       [:text_convert_available,        Redmine::Thumbnail.convert_available?] | 
					
						
							| 
									
										
										
										
											2009-12-19 20:33:24 +00:00
										 |  |  |     ] | 
					
						
							| 
									
										
										
										
											2011-04-25 23:21:34 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2006-06-28 18:11:03 +00:00
										 |  |  | end |