You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

admin_controller.rb 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # redMine - project management software
  2. # Copyright (C) 2006 Jean-Philippe Lang
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  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.
  17. class AdminController < ApplicationController
  18. layout 'base'
  19. before_filter :require_admin
  20. helper :sort
  21. include SortHelper
  22. def index
  23. end
  24. def projects
  25. sort_init 'name', 'asc'
  26. sort_update
  27. @project_count = Project.count
  28. @project_pages = Paginator.new self, @project_count,
  29. 15,
  30. @params['page']
  31. @projects = Project.find :all, :order => sort_clause,
  32. :limit => @project_pages.items_per_page,
  33. :offset => @project_pages.current.offset
  34. render :action => "projects", :layout => false if request.xhr?
  35. end
  36. def mail_options
  37. @actions = Permission.find(:all, :conditions => ["mail_option=?", true]) || []
  38. if request.post?
  39. @actions.each { |a|
  40. a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s
  41. a.save
  42. }
  43. flash.now[:notice] = l(:notice_successful_update)
  44. end
  45. end
  46. def info
  47. @adapter_name = ActiveRecord::Base.connection.adapter_name
  48. end
  49. end