annotate .svn/pristine/2c/2c03b2451a9c38796d0008f31034571e1a5677c0.svn-base @ 1478:5ca1f4a47171 bibplugin_db_migrations

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