@@ -1,123 +1,121 | |||||
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 ReportsController < ApplicationController |
|
18 | class ReportsController < ApplicationController | |
19 | menu_item :issues |
|
19 | menu_item :issues | |
20 | before_filter :find_project, :authorize |
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def issue_report |
|
22 | def issue_report | |
23 | @statuses = IssueStatus.find(:all, :order => 'position') |
|
23 | @statuses = IssueStatus.find(:all, :order => 'position') | |
24 |
|
24 | |||
25 | @trackers = @project.trackers |
|
25 | @trackers = @project.trackers | |
26 | @versions = @project.shared_versions.sort |
|
26 | @versions = @project.shared_versions.sort | |
27 | @priorities = IssuePriority.all |
|
27 | @priorities = IssuePriority.all | |
28 | @categories = @project.issue_categories |
|
28 | @categories = @project.issue_categories | |
29 | @assignees = @project.members.collect { |m| m.user }.sort |
|
29 | @assignees = @project.members.collect { |m| m.user }.sort | |
30 | @authors = @project.members.collect { |m| m.user }.sort |
|
30 | @authors = @project.members.collect { |m| m.user }.sort | |
31 | @subprojects = @project.descendants.active |
|
31 | @subprojects = @project.descendants.active | |
32 | issues_by_tracker |
|
32 | issues_by_tracker | |
33 | issues_by_version |
|
33 | issues_by_version | |
34 | issues_by_priority |
|
34 | issues_by_priority | |
35 | issues_by_category |
|
35 | issues_by_category | |
36 | issues_by_assigned_to |
|
36 | issues_by_assigned_to | |
37 | issues_by_author |
|
37 | issues_by_author | |
38 | issues_by_subproject |
|
38 | issues_by_subproject | |
39 |
|
39 | |||
40 | render :template => "reports/issue_report" |
|
40 | render :template => "reports/issue_report" | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def issue_report_details |
|
43 | def issue_report_details | |
44 | @statuses = IssueStatus.find(:all, :order => 'position') |
|
44 | @statuses = IssueStatus.find(:all, :order => 'position') | |
45 |
|
45 | |||
46 | case params[:detail] |
|
46 | case params[:detail] | |
47 | when "tracker" |
|
47 | when "tracker" | |
48 | @field = "tracker_id" |
|
48 | @field = "tracker_id" | |
49 | @rows = @project.trackers |
|
49 | @rows = @project.trackers | |
50 | @data = issues_by_tracker |
|
50 | @data = issues_by_tracker | |
51 | @report_title = l(:field_tracker) |
|
51 | @report_title = l(:field_tracker) | |
52 | render :template => "reports/issue_report_details" |
|
|||
53 | when "version" |
|
52 | when "version" | |
54 | @field = "fixed_version_id" |
|
53 | @field = "fixed_version_id" | |
55 | @rows = @project.shared_versions.sort |
|
54 | @rows = @project.shared_versions.sort | |
56 | @data = issues_by_version |
|
55 | @data = issues_by_version | |
57 | @report_title = l(:field_version) |
|
56 | @report_title = l(:field_version) | |
58 | render :template => "reports/issue_report_details" |
|
|||
59 | when "priority" |
|
57 | when "priority" | |
60 | @field = "priority_id" |
|
58 | @field = "priority_id" | |
61 | @rows = IssuePriority.all |
|
59 | @rows = IssuePriority.all | |
62 | @data = issues_by_priority |
|
60 | @data = issues_by_priority | |
63 | @report_title = l(:field_priority) |
|
61 | @report_title = l(:field_priority) | |
64 | render :template => "reports/issue_report_details" |
|
|||
65 | when "category" |
|
62 | when "category" | |
66 | @field = "category_id" |
|
63 | @field = "category_id" | |
67 | @rows = @project.issue_categories |
|
64 | @rows = @project.issue_categories | |
68 | @data = issues_by_category |
|
65 | @data = issues_by_category | |
69 | @report_title = l(:field_category) |
|
66 | @report_title = l(:field_category) | |
70 | render :template => "reports/issue_report_details" |
|
|||
71 | when "assigned_to" |
|
67 | when "assigned_to" | |
72 | @field = "assigned_to_id" |
|
68 | @field = "assigned_to_id" | |
73 | @rows = @project.members.collect { |m| m.user }.sort |
|
69 | @rows = @project.members.collect { |m| m.user }.sort | |
74 | @data = issues_by_assigned_to |
|
70 | @data = issues_by_assigned_to | |
75 | @report_title = l(:field_assigned_to) |
|
71 | @report_title = l(:field_assigned_to) | |
76 | render :template => "reports/issue_report_details" |
|
|||
77 | when "author" |
|
72 | when "author" | |
78 | @field = "author_id" |
|
73 | @field = "author_id" | |
79 | @rows = @project.members.collect { |m| m.user }.sort |
|
74 | @rows = @project.members.collect { |m| m.user }.sort | |
80 | @data = issues_by_author |
|
75 | @data = issues_by_author | |
81 | @report_title = l(:field_author) |
|
76 | @report_title = l(:field_author) | |
82 | render :template => "reports/issue_report_details" |
|
|||
83 | when "subproject" |
|
77 | when "subproject" | |
84 | @field = "project_id" |
|
78 | @field = "project_id" | |
85 | @rows = @project.descendants.active |
|
79 | @rows = @project.descendants.active | |
86 | @data = issues_by_subproject |
|
80 | @data = issues_by_subproject | |
87 | @report_title = l(:field_subproject) |
|
81 | @report_title = l(:field_subproject) | |
88 | render :template => "reports/issue_report_details" |
|
|||
89 | else |
|
|||
90 | redirect_to :action => 'issue_report', :id => @project |
|
|||
91 | end |
|
82 | end | |
92 |
|
83 | |||
|
84 | respond_to do |format| | |||
|
85 | if @field | |||
|
86 | format.html {} | |||
|
87 | else | |||
|
88 | format.html { redirect_to :action => 'issue_report', :id => @project } | |||
|
89 | end | |||
|
90 | end | |||
93 | end |
|
91 | end | |
94 | private |
|
92 | private | |
95 | def issues_by_tracker |
|
93 | def issues_by_tracker | |
96 | @issues_by_tracker ||= Issue.by_tracker(@project) |
|
94 | @issues_by_tracker ||= Issue.by_tracker(@project) | |
97 | end |
|
95 | end | |
98 |
|
96 | |||
99 | def issues_by_version |
|
97 | def issues_by_version | |
100 | @issues_by_version ||= Issue.by_version(@project) |
|
98 | @issues_by_version ||= Issue.by_version(@project) | |
101 | end |
|
99 | end | |
102 |
|
100 | |||
103 | def issues_by_priority |
|
101 | def issues_by_priority | |
104 | @issues_by_priority ||= Issue.by_priority(@project) |
|
102 | @issues_by_priority ||= Issue.by_priority(@project) | |
105 | end |
|
103 | end | |
106 |
|
104 | |||
107 | def issues_by_category |
|
105 | def issues_by_category | |
108 | @issues_by_category ||= Issue.by_category(@project) |
|
106 | @issues_by_category ||= Issue.by_category(@project) | |
109 | end |
|
107 | end | |
110 |
|
108 | |||
111 | def issues_by_assigned_to |
|
109 | def issues_by_assigned_to | |
112 | @issues_by_assigned_to ||= Issue.by_assigned_to(@project) |
|
110 | @issues_by_assigned_to ||= Issue.by_assigned_to(@project) | |
113 | end |
|
111 | end | |
114 |
|
112 | |||
115 | def issues_by_author |
|
113 | def issues_by_author | |
116 | @issues_by_author ||= Issue.by_author(@project) |
|
114 | @issues_by_author ||= Issue.by_author(@project) | |
117 | end |
|
115 | end | |
118 |
|
116 | |||
119 | def issues_by_subproject |
|
117 | def issues_by_subproject | |
120 | @issues_by_subproject ||= Issue.by_subproject(@project) |
|
118 | @issues_by_subproject ||= Issue.by_subproject(@project) | |
121 | @issues_by_subproject ||= [] |
|
119 | @issues_by_subproject ||= [] | |
122 | end |
|
120 | end | |
123 | end |
|
121 | end |
General Comments 0
You need to be logged in to leave comments.
Login now