diff 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
line wrap: on
line diff
--- a/app/controllers/admin_controller.rb	Wed Jan 23 13:11:25 2013 +0000
+++ b/app/controllers/admin_controller.rb	Thu Jun 20 13:14:14 2013 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -17,6 +17,10 @@
 
 class AdminController < ApplicationController
   layout 'admin'
+  menu_item :projects, :only => :projects
+  menu_item :plugins, :only => :plugins
+  menu_item :info, :only => :info
+
   before_filter :require_admin
   helper :sort
   include SortHelper	
@@ -26,14 +30,12 @@
   end
 	
   def projects
-    @status = params[:status] ? params[:status].to_i : 1
-    c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
-    unless params[:name].blank?
-      name = "%#{params[:name].strip.downcase}%"
-      c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name]
-    end
-    @projects = Project.find :all, :order => 'lft',
-                                   :conditions => c.conditions
+    @status = params[:status] || 1
+
+    scope = Project.status(@status)
+    scope = scope.like(params[:name]) if params[:name].present?
+
+    @projects = scope.all(:order => 'lft')
 
     render :action => "projects", :layout => false if request.xhr?
   end
@@ -61,7 +63,7 @@
     # Force ActionMailer to raise delivery errors so we can catch it
     ActionMailer::Base.raise_delivery_errors = true
     begin
-      @test = Mailer.deliver_test(User.current)
+      @test = Mailer.test_email(User.current).deliver
       flash[:notice] = l(:notice_email_sent, User.current.mail)
     rescue Exception => e
       flash[:error] = l(:notice_email_error, e.message)
@@ -75,7 +77,7 @@
     @checklist = [
       [:text_default_administrator_account_changed, User.default_admin_account_changed?],
       [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
-      [:text_plugin_assets_writable,   File.writable?(Engines.public_directory)],
+      [:text_plugin_assets_writable,   File.writable?(Redmine::Plugin.public_directory)],
       [:text_rmagick_available,        Object.const_defined?(:Magick)]
     ]
   end