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